develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #118815] Memory leak when thread terminated abnormally

Thread Previous | Thread Next
From:
Hazel
Date:
July 9, 2013 23:41
Subject:
[perl #118815] Memory leak when thread terminated abnormally
Message ID:
rt-3.6.HEAD-2552-1373364848-740.118815-75-0@perl.org
# New Ticket Created by  Hazel 
# Please include the string:  [perl #118815]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118815 >


-----------------------------------------------------------------
[Please describe your issue here]

When a thread terminated abnormally ( ie a die ) erl is leaking memory

use strict;
use threads;

sub dummy { die ; };

threads->create( \&dummy );

while( 1 ) {
         my @dead = threads->list( threads::joinable );
         foreach my $t ( @dead ) {
                 if( my $e = $t->error() ) { print "Error : $e\n" }
                 $t->join;
                 threads->create( \&dummy );
         }
}

Quick output from `ps`
haze     25229 66.0 11.0 400164  210952 pts/0   R+   10:48   0:00 ./bin/perl
haze     25229 88.5 28.1 720400  538220 pts/0   Rl+  10:48   0:01 ./bin/perl
haze     25229 85.6 39.2 927272  749800 pts/0   Rl+  10:48   0:02 ./bin/perl
haze     25229 84.2 49.5 1120988 947808 pts/0   Rl+  10:48   0:03 ./bin/perl

Replacing the die call in the dummy sub with a return does not trigger this


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About