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
In reply to memory usage and leakage by szabgab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |