From: datib...@php.net Operating system: Linux PHP version: 5.2.11 PHP Bug Type: Streams related Bug description: memory leak when stream_context_create is used
Description: ------------ When stream_context_create() is used in conjunction with file_get_contents() or other stream related functions that accept a context parameter, memory is being leaked. Reproduce code: --------------- for ($i=0;$i<5;++$i){ $m0 = memory_get_usage(); file_get_contents('http://www.google.com', false, stream_context_create(array())); $m1 = memory_get_usage(); echo $m1-$m0,PHP_EOL; } Expected result: ---------------- X (where X is the memory increase for the first iterator) 0 0 0 0 Actual result: -------------- X (where X is the memory increase for the first iterator) 384 (or something similar) 420 420 480 -- Edit bug report at http://bugs.php.net/?id=50111&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50111&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50111&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50111&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50111&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50111&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50111&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50111&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50111&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50111&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50111&r=support Expected behavior: http://bugs.php.net/fix.php?id=50111&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50111&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50111&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50111&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50111&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50111&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50111&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50111&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50111&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50111&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50111&r=mysqlcfg