PHP 5.1 memory leak?
| From: | Egon Hilgenstieler | Date: | Wed, 07 Nov 2007 17:21:47 +0000 |
| Subject: | PHP 5.1 memory leak? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-264193@lists.php.net to get a copy of this message | ||
Hi All,
My apologies if this question was already answered, I just couldn't find
it on the mail archive.
I have a really complex report which uses a tree-like structure of data
base objects. Usually it consumes a lot of memory but that it is not
really an issue because it is an intranet application with few users and
a dedicated server for it. The problem is that the memory allocated by
the script is never free'd!
My production server uses ubuntu 6.10 PHP 5.1.2 on apache2 using
mod_php. When the script is executed, it consumes about 5% of my memory,
event when it finishes, I can use 'top' and see that the memory is still
allocated:
USER NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
www-data 0 110m 98m 4064 S 0 4.9 0:16.51 apache2
If I execute the report several times I can consume as much memory as
the number of apache process I have.
The funny thing is that on my laptop I use ubuntu 7.04 PHP 5.2.1 an
apache2 using mod_php, and the memory is normally free'd when the script
finishes, no matter how many times I execute it.
Is it a PHP5.1 bug? Garbage collector couldn't handle my complex
structure? The only solution is to upgrade to PHP 5.2?
Any help would be greatly appreciated.
Egon