From: valyala at tut dot by Operating system: any PHP version: Irrelevant PHP Bug Type: Zend Engine 2 problem Bug description: PHP does not free memory, occupied by cross-referencing objects
Description: ------------ See reproducible code below Reproduce code: --------------- <? /** cross-referencing memory leak. PHP garbage collector doesn't free memory for cross-referencing objects. It could be great problem for daemons or services, written on PHP */ function memleak($size) { $a = str_repeat('a', $size); // construct child $child = array( 'data' => $a, ); // construct parent $parent = array( 'data' => $a, 'child' => &$child, ); // comment following line to prevent memleak $child['parent'] = &$parent; } // try to leak of 1GB memory for ($i = 0; $i < 1000; $i++) memleak(1000000); sleep(10); ?> Expected result: ---------------- normal execution of script Actual result: -------------- PHP occupies all available memory. -- Edit bug report at http://bugs.php.net/?id=32403&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32403&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32403&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32403&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32403&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32403&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32403&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32403&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32403&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32403&r=support Expected behavior: http://bugs.php.net/fix.php?id=32403&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32403&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32403&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32403&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32403&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32403&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32403&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32403&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32403&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32403&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32403&r=mysqlcfg