ID: 27174 Updated by: [EMAIL PROTECTED] Reported By: zor at smallinfinity dot com -Status: Open +Status: Bogus Bug Type: CGI related Operating System: Linux PHP Version: 4.3.4 New Comment:
Expected behaviour. Previous Comments: ------------------------------------------------------------------------ [2004-02-06 23:56:39] zor at smallinfinity dot com 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 this bug report at http://bugs.php.net/?id=27174&edit=1