Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#135 Memory leakage

0.65
closed-fixed
Martin Kutter
Misc/Other (17)
4
2008-02-01
2007-12-05
Anonymous
No

Just hope it is not simply trivial mistake. Sorry in advance...

The following program "sender.pl" apparently leaks memory:

=== cut here ===
#!/usr/bin/perl -w

use strict;
use SOAP::Transport::TCP;
while (1) {
SOAP::Lite
->proxy("tcp://192.168.100.2:8001")
->next();
print `ps -eo vsize,args | grep $0 | grep -v grep`;
sleep 1;
}
=== cut here ===

The printout is for demo purposes, and the leakage occurs also removing that line and the "sleep".

On server side:

=== cut here ===
#!/usr/bin/perl -w

use strict;
use SOAP::Transport::TCP;

sub next {
print "blip\n";
}

my $daemon = SOAP::Transport::TCP::Server
->new(LocalAddr => '192.168.100.2', LocalPort => 8001, Listen => 5, Reuse => 1)
->dispatch_to('next');
print "TCP server at ".$daemon->sockhost.":".$daemon->sockport."\n";
$daemon->handle();
=== cut here ===

The output:

===
pc01:~/prova# sender.pl
8116 /usr/bin/perl -w ./sender.pl
8116 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8248 /usr/bin/perl -w ./sender.pl
8380 /usr/bin/perl -w ./sender.pl
8380 /usr/bin/perl -w ./sender.pl
8380 /usr/bin/perl -w ./sender.pl
8380 /usr/bin/perl -w ./sender.pl
....
=== cut here ===

leaking approximately 16.6 bytes per round (9392 after 560 rounds).

I use the release currently used by Ubuntu 7.04, which appears to be 0.66.

Discussion

  • Logged In: NO

    Forgot to sign the item:

    mailto:geppetto_56@users.sourceforge.net

     
  • Logged In: YES
    user_id=1952722
    Originator: NO

    The (trivial) problem is the iterated creation of a SOAP::Lite item.

    The solution is simply:

    #!/usr/bin/perl -w

    use strict;
    use SOAP::Transport::TCP;
    my $k=SOAP::Lite
    ->proxy("tcp://192.168.100.2:8001");
    while (1) {
    $k->next();
    print `ps -eo vsize,args | grep $0 | grep -v grep`;
    sleep 1;
    }

     
  • Martin Kutter
    Martin Kutter
    2008-01-05

    • priority: 5 --> 4
    • assigned_to: byrnereese --> kutterma
     
  • Martin Kutter
    Martin Kutter
    2008-01-05

    Logged In: YES
    user_id=884175
    Originator: NO

    Hi geppeto,

    there's obviously something not cleaned up.

    As the leakage is relatively small, and only on creation/destruction of the SOAP::Lite object (not on every request sent/received), I'll adress this sometime in the future.

    It may already be fixed, too: one of the 0.70_xx pre-releases fixed a memory leak (I think it was 0.70_02...)

    Thanks for reporting,

    Martin

     
  • Martin Kutter
    Martin Kutter
    2008-02-01

    Logged In: YES
    user_id=884175
    Originator: NO

    This is fixed in the 0.70_0x pre-releases - the memory footprint stays constant with the scripts above.

     
  • Martin Kutter
    Martin Kutter
    2008-02-01

    • status: open --> closed-fixed