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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.