|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-07 22:48 UTC] sniper@php.net
[2004-02-08 00:16 UTC] zor at smallinfinity dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 22:00:02 2025 UTC |
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