ID: 27174 User updated by: zor at smallinfinity dot com Reported By: zor at smallinfinity dot com Status: Bogus Bug Type: CGI related Operating System: Linux PHP Version: 4.3.4 New Comment:
If this expected behaviour, is there any way to actually free up memory, Im trying to build a socket server and its takeing up about 40-50mbs a day that cant be cleared without stoping and starting the server. Ny avaliable resources are low without php seeing how much memory it can take holdng unset and old data. Previous Comments: ------------------------------------------------------------------------ [2004-02-07 22:48:34] [EMAIL PROTECTED] Expected behaviour. ------------------------------------------------------------------------ [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