From: zor at smallinfinity dot com Operating system: Linux PHP version: 4.3.4 PHP Bug Type: CGI related Bug description: unset dose not free up memory when used on arrays
Description: ------------ php-cli is not freeing up memory of an array. I am haveing this problem on a large scale and is makeing php take up 40mbs+. Iv tryed unsetting each value independly. It still had the same problem. Also this same thing seems to be happening to foreach. Reproduce code: --------------- <? $test_array = Array(); $pid = getmypid(); $loop = 2000; echo "Starting Memory:\n"; echo "USAGE (% KB PID ): " .`ps -eo%mem,rss,pid | grep $pid` . "\n"; for($i=0;$loop > $i;$i++){ $test_array[] = str_repeat("test", 5000); } echo "Finished Loop:\n"; echo "USAGE (% KB PID ): " .`ps -eo%mem,rss,pid | grep $pid` . "\n"; unset($test_array); echo "Cleaned Up:\n"; echo "USAGE (% KB PID ): " .`ps -eo%mem,rss,pid | grep $pid` . "\n"; ?> Expected result: ---------------- Starting Memory: USAGE (% KB PID ): 0.1 3592 14473 Finished Loop: USAGE (% KB PID ): 1.3 42880 14473 Cleaned Up: USAGE (% KB PID ): 1.3 3592 14473 Actual result: -------------- Starting Memory: USAGE (% KB PID ): 0.1 3592 14473 Finished Loop: USAGE (% KB PID ): 1.3 42880 14473 Cleaned Up: USAGE (% KB PID ): 1.3 42880 14473 -- Edit bug report at http://bugs.php.net/?id=27174&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27174&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27174&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27174&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27174&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27174&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27174&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27174&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27174&r=support Expected behavior: http://bugs.php.net/fix.php?id=27174&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27174&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27174&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27174&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27174&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27174&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27174&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27174&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27174&r=float