I went further and tried the Net::XMPP code:
#!/usr/bin/perl
use strict;
use warnings;
print_size('empty');
use Net::XMPP;
print_size("after Net::XMPP");
for (1..10) {
my $conn = Net::XMPP::Client->new;
print_size('Net::XMPP::Client created');
my $status = $conn->Connect(
hostname => 'talk.google.com',
port => 5222,
componentname => 'gmail.com',
connectiontype => 'tcpip',
tls => 1,
);
print_size('connection started');
$conn = undef;
}
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;
}
The result is
VM: 48596 RSS: 14648 - empty
VM: 48596 RSS: 14652 - after Net::XMPP
VM: 48808 RSS: 14744 - Net::XMPP::Client created
VM: 67920 RSS: 18344 - connection started
VM: 67920 RSS: 18344 - Net::XMPP::Client created
VM: 68072 RSS: 18408 - connection started
VM: 68072 RSS: 18408 - Net::XMPP::Client created
VM: 68192 RSS: 18464 - connection started
VM: 68192 RSS: 18464 - Net::XMPP::Client created
VM: 68192 RSS: 18516 - connection started
VM: 68192 RSS: 18516 - Net::XMPP::Client created
VM: 68300 RSS: 18572 - connection started
VM: 68300 RSS: 18572 - Net::XMPP::Client created
VM: 68412 RSS: 18648 - connection started
VM: 68412 RSS: 18648 - Net::XMPP::Client created
VM: 68516 RSS: 18712 - connection started
VM: 68516 RSS: 18712 - Net::XMPP::Client created
VM: 68636 RSS: 18784 - connection started
VM: 68636 RSS: 18784 - Net::XMPP::Client created
VM: 68740 RSS: 18856 - connection started
VM: 68740 RSS: 18856 - Net::XMPP::Client created
VM: 68848 RSS: 18928 - connection started
So if I understand correctly this means the Net::XMPP::Client is leaking memory? How could I better check it?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.