At the the mod_perl/Apache web site (http://perl.apache.org/faq/#Why_is_httpd_using_so_much_memor)
there is a section about memory usage and a
subroutine is given which can help test for memory leaks which perl "does no
overtly report"
Joel Wagner reports that calling an undefined subroutine in a module can cause a tight loop that consumes all memory. Here is a way to catch such errors. Define an autoload subroutine sub UNIVERSAL::AUTOLOAD { my $class = shift; warn "$class can't `$UNIVERSAL::AUTOLOAD'!\n"; } It will produce a nice error in error_log, giving the line number of the call and the name of the undefined subroutine. I edited this to get a little more info: sub UNIVERSAL::AUTOLOAD
{ I was able to clean up a number of errors which seemed as though they were indeed causing leaks. For example: $regex = qr'xx?'i; Causes the following error: (?i-xsm:xx?) can't
`Regexp::DESTROY' The only solution I found was to not precompile the regex but it would definilty be nice so as to save some time as I repeatedly use numeros patterns which I was precompliling.
Another error I found was with the use of LWP:
I was able to erradicat this error by adding DynaLoader to the @ISA of LWP::UserAgent. OK not so bad but one error I have been unable erradicat is the following: Apache=SCALAR(0x84da840) can't
`Apache::DESTROY' I have not found that Apache,pm has a ISA to add dynaloader to and I have not yet trid adding it my self but......any ideas on where this (apparent) leak is comming from? It adds 4k to a child per request. On a site with the amount of traffic we have that is death!!!!
Thanks in advance! Jason Z. Leidigh |
- Memory Leaks? Ben Bell
- Re: Memory Leaks? Doug MacEachern
- Re: Memory Leaks? Ben Bell
- Memory leaks? Per 'stripe' Moeller
- Re: Memory leaks? Matt Sergeant
- Re: Memory Leaks? Jason Leidigh
- Re: Memory Leaks? Robin Berjon