[OT] finding memory hungry bits of my code

Tatsuhiko Miyagawa miyagawa at gmail.com
Thu Apr 9 23:50:10 BST 2009

B::TerseSize might be what you want, and Apache2 has a Status handler
to enable that.

In a standalone script you can do:

use B::TerseSize;
use Devel::Symdump;

my $stab = Devel::Symdump->rnew("main");
my %size;
for my $package ("main", $stab->packages) {
    my($subs, $opcount, $opsize) = B::TerseSize::package_size($package);
    $size{$package} = $opsize;
for my $package (sort {$size{$b}<=>$size{$a}} keys %size) {
    printf "%-24s %8d [KB]\n", $package, $size{$package}/1024;

to get the equivalent.

On Thu, Apr 9, 2009 at 4:31 AM, Edmund von der Burg
<edmund.vonderburg at gmail.com> wrote:
> I don't think that it is a memory leak - the size tends to remain
> constant after a few requests (it's a webapp - Catalyst under
> mod_perl).
Tatsuhiko Miyagawa

More information about the london.pm mailing list