Testing For Memory Leaks

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi folks,

I rolled my own OOPHP database abstraction layer a la Perl's
Class::DBI and it is seeing increasingly heavy production use.

I am concerned about how it will scale and want to use a testing
harness of some kind to see where I could improve memory use and be I
don't have leaks.

Anyone use such a harness?  Any other advice for this situation?



Re: Testing For Memory Leaks

jerrygarciuh wrote:
Quoted text here. Click to load it

Hi Jerry,

Why are you afraid of memoryleaks?
You are using pure PHP in your OOPHP DB abstractionlayer, right?

If so, PHP is invoked per page that is called, and ends when your script
finished processing.
As far as I can see, any memoryleaks occuring are caused by a bug in the
PHP engine, and not directly in your code, and thus should be reported
to bugs.php.net.

You shouldn't be able to leak memory by using pure PHP.

Do you have any issues with your current implementation that put you on
this (memleakage) track?

Erwin Moller

Re: Testing For Memory Leaks

On Mar 19, 6:44 am, Erwin Moller
Quoted text here. Click to load it

Hi Erwin,

Thanks for the reply!  The abstraction layer is pure PHP.  What is
happening is that I have a host (DreamHost) where I have account
specific memory.  This memory covers about 70 sites almost all of
which are dynamic and use my layer.  One is a a WordPress site which
is a notorious memory hog.  Every day I am seeing a gradual and
persistent climb to almost a gig of memory used.  This abates
immediately after I reboot the server.  I can see it via their admin
and also using free and top from the command line.  I have SSH access
but not root here.

I am trying to get them to run a ps -aux for all my accounts during
the next spike to see if I can narrow this down.  Anyway any advice is
most welcome!


Site Timeline