Profiling Perl app memory usage

Nik Clayton nik at
Thu Feb 2 12:38:42 GMT 2006

IvorW wrote:
>> Is anyone aware of anything that makes it easier to portably 
>> track a Perl app's memory usage?
> Try Devel::Size for size.

Devel::Size is great for individual variables, but doesn't give you a total 
memory footprint.

> There's also the Devel::Leak family of modules

Similar problem.

They're great when you know you have a problem, and want to track down 
exactly what the problem is.  But what I need to start with is something 
that makes it easy to determine that there is a problem.

Being able to do (hypothetical):

     print $process->resident_set_size();

There's Memchmark, on CPAN, but the approach is hacky (run a sub { } in a 
new process, and use Proc::ProcessTable), isn't accurate (the docs talk 
about 30% error bars).

Hmm.  Proc::ProcessTable instead of qx{ ps ... $$} might work.


More information about the mailing list