szabgab has asked for the wisdom of the Perl Monks concerning the following question:
An application I am writing uses a lot of memory and there seem to be a serious memory leakage I try to track down.
As I am far from being a memory expert I wonder if even I am looking at the right numbers and if the baseline information is correct?
I am using the following script to check its own memory usage:
and when running on SuSE with perl 5.10.0 I get the following data:#!/usr/bin/perl use strict; use warnings; print_size('empty'); foreach my $module ( 'Data::Dumper', 'Scalar::Util', 'Getopt::Long', 'Net::XMPP', 'JSON::XS', 'LWP::UserAgent', 'POE qw(Component::Server::TCP)', 'Moose', ) { eval "use $module"; die $@ if $@; print_size("after $module"); } sub print_size { my ($msg) = @_; my @lines = qx{/bin/ps -e -o pid,ppid,vsize,rss,command | grep ^$$ +}; chomp @lines; foreach my $line (@lines) { my ($pid, $ppid, $vsize, $rss) = split /\s+/, $line; print "VM: $vsize RSS: $rss - $msg\n"; } return; }
So if I understand correctly my script starts - after loading all the necessary modules - with 88 Mb memory used? Do I see correctly that loading Moose take 20Mb without even creating classes and objects? Net::XMPP is even bigger as it takes 30Mb ? Is the way I am measuring correct? As I'll need to run several instances of this process at the same time will they share some memory or will this number just be multiplied by the number of processes I have?VM: 15972 RSS: 2324 - empty VM: 18740 RSS: 3256 - after Data::Dumper VM: 20968 RSS: 3388 - after Scalar::Util VM: 21760 RSS: 4240 - after Getopt::Long VM: 51348 RSS: 15408 - after Net::XMPP VM: 53648 RSS: 15588 - after JSON::XS VM: 57980 RSS: 17704 - after LWP::UserAgent VM: 65852 RSS: 21572 - after POE qw(Component::Server::TCP) VM: 88616 RSS: 31924 - after Moose
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: memory usage and leakage
by Sewi (Friar) on Jun 23, 2011 at 11:06 UTC | |
by BrowserUk (Patriarch) on Jun 23, 2011 at 12:15 UTC | |
by Sewi (Friar) on Jun 23, 2011 at 15:14 UTC | |
by BrowserUk (Patriarch) on Jun 23, 2011 at 15:58 UTC | |
by szabgab (Priest) on Jun 23, 2011 at 11:10 UTC | |
Re: memory usage and leakage
by mirod (Canon) on Jun 23, 2011 at 12:46 UTC | |
by szabgab (Priest) on Jun 23, 2011 at 13:28 UTC | |
by mirod (Canon) on Jun 23, 2011 at 13:31 UTC | |
by Anonymous Monk on Jun 23, 2011 at 13:50 UTC | |
memory leakage
by szabgab (Priest) on Jun 23, 2011 at 12:14 UTC | |
by szabgab (Priest) on Jun 23, 2011 at 12:33 UTC | |
by Anonymous Monk on Jun 23, 2011 at 12:33 UTC | |
Re: memory usage and leakage
by sundialsvc4 (Abbot) on Jun 23, 2011 at 13:36 UTC | |
by Sewi (Friar) on Jun 23, 2011 at 15:24 UTC | |
by szabgab (Priest) on Jun 26, 2011 at 10:32 UTC | |
Re: memory usage and leakage
by Anonymous Monk on Jun 23, 2011 at 11:41 UTC |
Back to
Seekers of Perl Wisdom