Devel::MemoryTrace::Light

2011-06-14 21:52:55 UTC

This is a little Perl module I wrote to figure out what was causing memory growth in some pretty large projects I was working on. It's fairly simple to use:

perl -d:MemoryTrace::Light ./program.pl

That will run program.pl under the perl debugger and print out a message when Perl requests more memory from the OS. This is done very simply by using GTop or BSD::Process to request the current program's resident set size after every line of execution. If it detects a change, it calls an overridable method which, by default, prints out a message to STDOUT.

There's a few configurable features (VIA an %ENV variable):

As well as some run time control:

Hope you find it useful: Devel::MemoryTrace::Light on CPAN.

-- Matthew Horsfall (alh)