Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

acme (189)

  (email not shown publicly)

Leon Brocard (aka acme) is an orange-loving Perl eurohacker with many varied contributions to the Perl community, including the GraphViz module on the CPAN. YAPC::Europe was all his fault. He is still looking for a Perl Monger group he can start which begins with the letter 'D'.

Journal of acme (189)

Thursday January 22, 2009
11:50 AM

Finite memory

[ #38328 ]

Computer memory is sadly still finite. Sometimes it's interesting to know how much memory a Perl script might be taking at a particular time. If you install the GTop development headers and library you can use:

use strict;
use warnings;
use GTop ();
use Number::Bytes::Human qw(format_bytes);

my $gtop     = GTop->new;
my $proc_mem = $gtop->proc_mem($$);
my $size     = $proc_mem->size;
print format_bytes($size) . "\n";

Which produces something like:


So you can find out that the module you were criticising isn't bloated code after all...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • To calculate the actual overhead you should substract what Perl needs for itself. See "" in the mod_perl manual [].

    That program has a small bug, if one wants to load a naked file, it gives Warning: Use of "require" without parentheses is ambiguous at (eval 4) line 1. To make it work correctly:

    -      if (eval "require $_") {
    +      if (eval "require q($_)") {