From: [email protected] 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
