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

From: Date: Mon, 03 May 2004 14:05:08 +0000
Subject: #28260 [Opn]: readfile + session_start results in huge memory consumption
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59163@lists.php.net to get a copy of this message
ID: 28260 User updated by: mb at diderot dot de Reported By: mb at diderot dot de Status: Open Bug Type: Session related Operating System: Linux PHP Version: 4.3.6 New Comment: With php5 this just works fine ;) Previous Comments: ------------------------------------------------------------------------ [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 (#59163) next »