|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-01-27 15:32 UTC] tony2001@php.net
[2007-01-27 16:01 UTC] angry dot slipper at gmail dot com
[2007-01-27 16:20 UTC] angry dot slipper at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
Description: ------------ stream_context_create() causes memory leaks. PHP version is actualy 5.2.1RC5 - latest available. Reproduce code: --------------- #!/www/httpd/php/cli -ne <?php $postdata=array_fill(0,128,"blah"); for ($a=0;$a<100;$a++){ $options=array('http'=>array( 'method'=>"POST", 'request_fulluri'=>"POST http://www.google.com HTTP/1.0", 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context=stream_context_create($options); unset($context,$options); echo "current: ",memory_get_usage()," delta: ",(memory_get_usage()-$prev)."\n"; $prev=memory_get_usage(); } ?> Expected result: ---------------- "current: 74496 delta: 0" line repeated. Actual result: -------------- current: 87368 delta: 87368 current: 100008 delta: 12520 <...many lines here> current: 1319348 delta: 12440 As you can clearly see each iteration eatch 12kb of RAM, which it shouldn't. If you comment the $context=stream_context_create($options); line out, delta in the example above will always be at 0.