From: lf at burntmail dot com Operating system: Linux PHP version: 5.0.0b4 (beta4) PHP Bug Type: Zend Engine 2 problem Bug description: list() array key assignment
Description: ------------ When using array keys as variables in the list() function there is a noticiable memory leak. It doesn't seem to matter if you assign values to the array key's before using them in the array. Reproduce code: --------------- //memory leak! while (1) { $out = array(); $arr = array('a','b','c'); list($out['a'], $out['b'], $out['c']) = $arr; } //NO memory leak!! while (1) { $out = array(); $a = &$out['a']; $b = &$out['b']; $c = &$out['c']; $arr = array('a','b','c'); list($a, $b, $c) = $arr; } Expected result: ---------------- Output every 4000 loops # | Memory usage 4000 | 68 KB 8000 | 68 KB 12000 | 68 KB 16000 | 68 KB 20000 | 68 KB 24000 | 68 KB 28000 | 68 KB 32000 | 68 KB 36000 | 68 KB 40000 | 68 KB 44000 | 68 KB 48000 | 68 KB 52000 | 68 KB 56000 | 68 KB 60000 | 68 KB 64000 | 68 KB 68000 | 68 KB 72000 | 68 KB 76000 | 68 KB 80000 | 68 KB 84000 | 68 KB 88000 | 68 KB 92000 | 68 KB 96000 | 68 KB 100000 | 68 KB 104000 | 68 KB 108000 | 68 KB 112000 | 68 KB Actual result: -------------- Output every 4000 loops # | Memory usage 4000 | 349 KB 8000 | 630 KB 12000 | 911 KB 16000 | 1.2 MB 20000 | 1.4 MB 24000 | 1.7 MB 28000 | 2.0 MB 32000 | 2.3 MB 36000 | 2.5 MB 40000 | 2.8 MB 44000 | 3.1 MB 48000 | 3.4 MB 52000 | 3.6 MB 56000 | 3.9 MB 60000 | 4.2 MB 64000 | 4.5 MB 68000 | 4.7 MB 72000 | 5.0 MB 76000 | 5.3 MB 80000 | 5.6 MB 84000 | 5.8 MB 88000 | 6.1 MB 92000 | 6.4 MB 96000 | 6.7 MB 100000 | 6.9 MB 104000 | 7.2 MB 108000 | 7.5 MB 112000 | 7.8 MB -- Edit bug report at http://bugs.php.net/?id=27598&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27598&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27598&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27598&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27598&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27598&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27598&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27598&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27598&r=support Expected behavior: http://bugs.php.net/fix.php?id=27598&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27598&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27598&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27598&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27598&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27598&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27598&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27598&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27598&r=float