ID: 50111 Updated by: j...@php.net Reported By: datib...@php.net -Status: Open +Status: Feedback Bug Type: Streams related Operating System: Linux PHP Version: 5.2.11 New Comment:
What code? There is no such script in this report that crashes. Not even when changed to loop thousands of times. Not with PHP_5_2 or PHP_5_3 or HEAD branches. So please, come up with a proper reproducing script. Previous Comments: ------------------------------------------------------------------------ [2009-11-18 14:05:35] datib...@php.net I've change the summary a bit to avoid confusion with an actual memory leak (those that would get reported by php at the end of execution in debug mode). When kept running (using cli), an endless loop of given code would eventually result in an out-of-memory error. In PHP 5.3.x this no longer happens, so it seems that this has been rectified before, just not in this branch. It would be nice if the same fix could be applied here. ------------------------------------------------------------------------ [2009-11-09 17:11:31] j...@php.net 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 ------------------------------------------------------------------------ [2009-11-08 23:27:05] datib...@php.net Test code changed to (added the unset() statement): $m0 = $m1 = $i = 0; $c = null; while ($i<5) { $m0 = memory_get_usage(); $c = stream_context_create(); unset($c); $m1 = memory_get_usage(); echo $m1-$m0,PHP_EOL; ++$i; } Output: 336 420 420 420 420 Though, as a language feature I would assume that in the second iteration the memory occupied by the previous assignment would be freed implicitly. Is that a wrong assumption? ------------------------------------------------------------------------ [2009-11-08 21:17:53] srina...@php.net hmmm.. not sure, why u think there is a leak. when u write this below code $c = stream_context_create(); u do understand that underlying php engine need to do some processing underneath and store the reference of this processing in $c variable. this does require some memory consumption. i guess, if u do some thing like and still no $c = stream_context_create.. unset($c); $m1 = memory_get_usage(); and still see memory leak , then let us know.. ------------------------------------------------------------------------ [2009-11-08 01:06:54] datib...@php.net Code to reproduce can be made simpler, since the problem seems to be with stream_context_create(): $m0 = $m1 = $i = 0; $c = null; while ($i<5) { $m0 = memory_get_usage(); $c = stream_context_create(); $m1 = memory_get_usage(); echo $m1-$m0,PHP_EOL; ++$i; } ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/50111 -- Edit this bug report at http://bugs.php.net/?id=50111&edit=1