ID: 37929 Updated by: [EMAIL PROTECTED] Reported By: joe at estara dot com -Status: Open +Status: Feedback Bug Type: Apache2 related Operating System: Linux PHP Version: 5.1.4, 4.4.0 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2006-07-20 15:40:48] joe at estara dot com Meant to say if the same apache process is hit, it won't grow higher, but every apache process that is hit grows to the high level of this script (`21M, which will swap the machine to death eventually). It's only this data structure that leaks, if I change it slightly it doesn't leak, so I'm guessing it's the garbage collector. ------------------------------------------------------------------------ [2006-07-20 15:38:39] joe at estara dot com Mike: Please just run this below script on your machine, and then use top, hit 'M' to sort by memory and apache will be the top memory user. hit the script 10 times and your machine will start swapping to death. This appears to be apache related: if the same script is hit, it doesn't leak MORE memory, it stays at the outrageously high level it got to the first time. <?php ini_set("memory_limit", "64M"); function make_arr() { for($i=0; $i<396768; $i++) $a[sprintf("%05d",$i)] = array(0 => "PHPLEAKS923889239823", 1 => "PHPLEAK2349082349898"); return $a; } for($i=0;$i<10;$i++) $zip[$i] = make_arr(); for($i=0;$i<10;$i++) preg_match("/asdfl/", $zip[$i]["00601"][0]); ?> ------------------------------------------------------------------------ [2006-07-20 15:23:40] [EMAIL PROTECTED] Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Any evidence like valgrind etc? The OS releases memory when it needs it. ------------------------------------------------------------------------ [2006-07-06 18:27:57] joe at estara dot com Arrays of arrays leak memory in many PHP versions. ------------------------------------------------------------------------ [2006-07-01 00:15:27] joe at estara dot com Here, fully contained version that will make a 131M leak in 12 lines. <?php ini_set("memory_limit", "64M"); function make_arr() { for($i=0; $i<396768; $i++) $a[sprintf("%05d",$i)] = array(0 => "PHPLEAKS923889239823", 1 => "PHPLEAK2349082349898"); return $a; } for($i=0;$i<10;$i++) $zip[$i] = make_arr(); for($i=0;$i<10;$i++) preg_match("/asdfl/", $zip[$i]["00601"][0]); ?> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37929 -- Edit this bug report at http://bugs.php.net/?id=37929&edit=1