#28260 [Opn->Fbk]: readfile + session_start results in huge memory consumption

From: Date: Mon, 10 May 2004 18:13:05 +0000
Subject: #28260 [Opn->Fbk]: readfile + session_start results in huge memory consumption
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59474@lists.php.net to get a copy of this message
ID: 28260 Updated by: iliaa@php.net Reported By: mb at diderot dot de -Status: Open +Status: Feedback Bug Type: Session related Operating System: Linux PHP Version: 4.3.6 New Comment: Are you sure you don't have output buffering of any sort enabled? Previous Comments: ------------------------------------------------------------------------ [2004-05-03 16:05:07] mb at diderot dot de With php5 this just works fine ;) ------------------------------------------------------------------------ [2004-05-03 15:16:58] mb at diderot dot de Description: ------------ When using readfile or fread in combination with session_start php seems to allocate memory for the whole filesize. Without session_start it doesn't. Replacing readfile by a fread loop doesn't make any difference. Reproduce code: --------------- <?php //error appears: session_start(); readfile('big.zip'); //big.zip > memory_limit ?> <?php //working fine: readfile('big.zip'); //big.zip > memory_limit ?> <?php //fread version, same error session_start(); $fp = fopen('big.zip'); while($d = fread($fp,4096)) { echo $d; flush(); } ?> Expected result: ---------------- Memory consumation should stay much bellow the whole filesize as it does without sessions. Actual result: -------------- apache error.log: Allowed memory size of 16777216 bytes exhausted (tried to allocate 138188800 bytes) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28260&edit=1

« previous php.bugs (#59474) next »