Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

memory leakage

by szabgab (Priest)
on Jun 23, 2011 at 12:14 UTC ( #911071=note: print w/ replies, xml ) Need Help??


in reply to memory usage and leakage

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?


Comment on memory leakage
Select or Download Code
Re: memory leakage
by szabgab (Priest) on Jun 23, 2011 at 12:33 UTC
    Added
    use Devel::LeakGuard::Object qw(leakguard);
    and then leakguard around the for loop and I got:
    Object leaks found: Class Before After Delta FileHandle 0 10 10 IO::Select 0 20 20 IO::Socket::SSL 0 10 10 IO::Socket::SSL::SSL_Context 0 10 10 IO::Socket::SSL::SSL_HANDLE 0 10 10 Net::XMPP::Client 0 10 10 Net::XMPP::Debug 0 10 10 XML::Stream 0 10 10 XML::Stream::Parser 0 20 20 utf8 0 1 1
    I guess this means there is a memory leak.
Re: memory leakage
by Anonymous Monk on Jun 23, 2011 at 12:33 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://911071]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2014-07-26 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls