|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-03 16:05 UTC] mb at diderot dot de
[2004-05-10 20:13 UTC] iliaa@php.net
[2004-05-11 17:50 UTC] mb at diderot dot de
[2004-05-11 20:26 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Feb 07 08:00:01 2026 UTC |
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)