Ah well ;-) GTop... this Module also has the advantage that you can query any kind of size, and you get it in bytes. Voilà:
package MemImpact::GTop; use strict; use GTop; my @meths = qw(size vsize rss share); my $before = GTop->new->proc_mem($$); my $after = my $now = $before; printf "%-60s % 10d Bytes\n", "$_ initial memory:" , $before->$_ for @meths; print "-" x 77, $/; sub import { my $pack = shift; my $meth = shift; for (@_) { eval "use $_;"; die "Can't load $_:\n$@\n" if $@; $after = GTop->new->proc_mem($$); printf "%-60s % 10d Bytes\n", "$meth after loading $_:" , $aft +er->$meth; printf "%-60s % 10d Bytes\n", "$meth impact of $_:" , $after-> +$meth - $now->$meth; $now = $after; } } END { print "-" x 77, $/; printf "%-60s % 10d Bytes\n", "$_ total impact:" , $after->$_ - $b +efore->$_ for @meths; } 1;
qwurx [shmem] ~ > perl -e 'use MemImpact::GTop qw(rss Moose); use MemI +mpact::GTop qw(rss MooseX::AttributeHelpers)' size initial memory: 934707 +2 Bytes vsize initial memory: 934707 +2 Bytes rss initial memory: 346112 +0 Bytes share initial memory: 250265 +6 Bytes ---------------------------------------------------------------------- +------- rss after loading Moose: 897433 +6 Bytes rss impact of Moose: 551321 +6 Bytes rss after loading MooseX::AttributeHelpers: 1043660 +8 Bytes rss impact of MooseX::AttributeHelpers: 146227 +2 Bytes ---------------------------------------------------------------------- +------- size total impact: 711065 +6 Bytes vsize total impact: 711065 +6 Bytes rss total impact: 697548 +8 Bytes share total impact: 35225 +6 Bytes
In reply to Re^3: memory usage of modules
by shmem
in thread memory usage of modules
by shmem
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |