ID: 37929 Updated by: [EMAIL PROTECTED] Reported By: joe at estara dot com -Status: Open +Status: Bogus Bug Type: Apache2 related Operating System: Linux PHP Version: 5.1.4 New Comment:
PHP releases all the memory taken during the request and it's up to the memory manager used in your OS to decide when to start using it in other processes. Not PHP problem. Previous Comments: ------------------------------------------------------------------------ [2006-06-27 14:44:56] joe at estara dot com Description: ------------ If you use unserialize on a large multidimensional array, each apache process it runs in ends up taking up over 68m of ram (the actual size depends on your array that you're unserializing) This is actual ram (Resident minus shared ram), and doesn't return it to the operating system after the script exits. Since you have say MaxClients in apache2 of 150, 150 times 68m of ram means swapping to death. This is using prefork. Reproduce code: --------------- <?php ini_set("memory_limit", "64M"); # ziplatlong is an array, with zip code as a key and a 2 element lat long array as the value $s = file_get_contents("ziplatlong"); $zip = unserialize($s); preg_match("/foo/", $zip["00601"][0]); Expected result: ---------------- I'd expect most of the ram returned to the operating system. When I do something similar, use the same levels of ram, apache only takes up ~10M of ram, even though it uses ~64M while processing. <?php ini_set("memory_limit", "64M"); for($i=0;$i<50; $i++) $s[$i] = file_get_contents("ziplatlong"); preg_match("/foo/", $s[38]); Actual result: -------------- Machine swaps to death. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37929&edit=1