ID: 37929 User updated by: joe at estara dot com Reported By: joe at estara dot com Status: Open Bug Type: Apache2 related Operating System: Linux PHP Version: 5.1.4, 4.4.0 New Comment:
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]); ?> Previous Comments: ------------------------------------------------------------------------ [2006-07-01 00:00:26] joe at estara dot com It's 8 lines without comments. You want me to write a script to make the data file instead of just downloading it? <?php ini_set("memory_limit", "64M"); $s = file_get_contents("ziplatlong"); $z = unserialize($s); for($i=0;$i<10;$i++) $zip[$i] = unserialize($s); for($i=0;$i<10;$i++) preg_match("/asdfl/", $zip[$i]["00601"][0]); ?> ------------------------------------------------------------------------ [2006-06-30 23:17:27] [EMAIL PROTECTED] Please provide _SHORT_ and complete reproduce script. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. ------------------------------------------------------------------------ [2006-06-30 23:02:54] joe at estara dot com Download an example here: http://zeus-1.estara.com/php_mem_leak.zip ------------------------------------------------------------------------ [2006-06-30 22:03:56] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2006-06-30 20:43:58] joe at estara dot com So I rewrote the unserialize function in php, and it still is happening. Totally bizare, the leak must be somewhere deeper in PHP. If I make copies of the array using array_merge it doesn't use more memory, but if I unserialize again it uses more memory each time, even in an ALL php version. Please email me if you want example data file. ------------------------------------------------------------------------ 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