use GTop (); my $gtop = GTop->new; my $proc = $gtop->proc_mem($$); print "size before: ", $gtop->proc_mem($$)->size(), " B\n"; { my $x = 'a' x 10**7; print "size inside: ", $gtop->proc_mem($$)->size(), " B\n"; } print "size after: ", $gtop->proc_mem($$)->size(), " B\n";