You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Hann, Brian" <Br...@umb.com> on 2002/12/02 20:09:51 UTC

Horrible handler memory leak

I'm having a problem with a fairly simple handler eating up resources and I'm wondering if there's any easy way to track it down.
 
The handler fetches data from an Oracle database and displays it using Template-Toolkit.  Nothing fancy, just some display logic, etc.
 
The thing is, when I try to show all 8000 records the process spirals upwards towards 500M and it has to be killed.  With smaller amounts of records (~100-1000), the process STILL grows by several megs.  There really isn't that much data going through other than the sheer amount of records so I'm wondering what's eating the resources.
 
Thanks,
 
Brian Hann

Re: Horrible handler memory leak

Posted by Stas Bekman <st...@stason.org>.
Hann, Brian wrote:
 > I'm having a problem with a fairly simple handler eating up resources
 > and I'm wondering if there's any easy way to track it down.
 >
 > The handler fetches data from an Oracle database and displays it
 > using Template-Toolkit.  Nothing fancy, just some display logic, etc.
 >
 >
 > The thing is, when I try to show all 8000 records the process spirals
 > upwards towards 500M and it has to be killed.  With smaller amounts
 > of records (~100-1000), the process STILL grows by several megs.
 > There really isn't that much data going through other than the sheer
 > amount of records so I'm wondering what's eating the resources.

When storing lots of small records in Perl the overhead of the data 
management is very big. You can check the real memory usage with B::Size 
(which can be conveniently invoked via Apache::Status). See 
http://perl.apache.org/ for some examples.

Consider using some other way to represent data in your perl code (e.g. 
dbm files). Also see the list archives for similar discussions.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com