Funny memory leak problem.
| From: | Dennis da Menace | Date: | Fri, 19 Nov 1999 06:35:20 +0000 |
| Subject: | Funny memory leak problem. | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6473@lists.php.net to get a copy of this message | ||
Hi,
I am using PHP4-B2, together with Apache 1.3.9 (Ben-SSL) and
occassionally get httpd processes all of a sudden taking up 30% of the
memory (a bit of a bummer).
The load on the server is not big, and with a MaxRequestsPerChild set to
something like 25 there are no problems, but I would still like to know
what actually causes it.
The script does quite a big of MySQL quering, occasionally it'll exec()
something, and it does not mysql_free_result() it's data. I thought PHP
(or the new Zend engine) would always at the end of the script
deallocate all of the memory - 100% effective garbage collecting. But
every now and then I will see an httpd process taking up more than 30%
of memory (they usually sit at 1.7 - 2.0 %) - and even with a
MaxRequestsPerChild of 25 - so whatever it is it is leaking like crazy
:-)
It's not that I don't want to clean up the script and do proper garbage
collecting myself, but I was under the impression you wouldn't have to
worry about memory in the first place. Can someone give me an example of
a script that will hog lots of memory in a short time, and will make the
httpd process keep that memory while the connection is already lost? For
educational purposes :-))
On a sidenote, the session_handling -> isn't it supposed to clean up
it's temp files in /tmp? I know there is this var that holds the
probability for garbage collecting, and I've played with that but I've
never seen PHP actually take care of the /tmp files it used. (Users are
not forced to log in and out, I just want the session to expire after
say a day, and the associated /tmp/$phpsession_id() file deleted.
Hope I'm not missing a bunch of obvious bits :-)
Thanks for any input!
Dennis