ID:               37929
 User updated by:  joe at estara dot com
 Reported By:      joe at estara dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Apache2 related
 Operating System: Linux
 PHP Version:      5.1.4, 4.4.0
 New Comment:

Download an example here:
http://zeus-1.estara.com/php_mem_leak.zip


Previous Comments:
------------------------------------------------------------------------

[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.

------------------------------------------------------------------------

[2006-06-30 18:42:39] joe at estara dot com

This is not the operating systems fault. This is PHP's fault.  It's
present in 4.4.0-4 as well. Under debian and fedora core 4.   

This leaks 800M of ram on a single run.

<?php

ini_set("memory_limit", "800M");
for($i=0;$i<160; $i++) 
  $s[$i] = file_get_contents("ziplatlong"); 
for($i=0;$i<160; $i++) 
   preg_match("/foo/", $s[$i]);

This uses 800m but immediately returns it to the operating system under
both versions and OSs. 

<?php
ini_set("memory_limit", "800M");
for($i=0;$i<260; $i++)
  $s[$i] = file_get_contents("ziplatlong");
for($i=0;$i<260; $i++)
   preg_match("/foo/", $s[$i]);

I'll email you a zip file so you can easily reproduce this PHP bug.

------------------------------------------------------------------------

[2006-06-28 13:09:32] joe at estara dot com

Tony; 
Why then when I rewrite this to be exactly the same except for the
unserialize does it give all the ram back?   I've tried this with 6
different methods to grab a bunch of ram, every other method returns
the ram on exit.  unserialize is the only path with a memory leak.

------------------------------------------------------------------------

[2006-06-28 08:12:52] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

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

Reply via email to