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

From: Date: Tue, 11 May 2004 18:26:41 +0000
Subject: #28260 [Opn->Bgs]: readfile + session_start results in huge memory consumption
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59513@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: Bogus Bug Type: Session related Operating System: Linux PHP Version: 4.3.6 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php When using buffer, data inside the buffer will not be freed right away. Previous Comments: ------------------------------------------------------------------------ [2004-05-11 17:50:05] mb at diderot dot de I used flush() to prevent buffering. What surprises me is that it works in php5 without settings. ------------------------------------------------------------------------ [2004-05-10 20:13:04] iliaa@php.net Are you sure you don't have output buffering of any sort enabled? ------------------------------------------------------------------------ [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 (#59513) next »