Profiling Perl app memory usage

Nicholas Clark nick at ccl4.org
Thu Feb 2 12:58:55 GMT 2006


On Thu, Feb 02, 2006 at 12:38:42PM +0000, Nik Clayton wrote:
> 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.

You can get mostly there with total_size(\%::) but it's not perfect, as it
doesn't yet know about all the memory all perl structures allocate.

In theory you (well, anyone) could take the ithreads cloning code and hack
it to chase down everything that gets allocated, but that doesn't show you
leaks.

Is wrapping a call to sbrk(0) with Inline::C good enough?

Nicholas Clark


More information about the london.pm mailing list