develooper Front page | perl.perl5.porters | Postings from February 2009

Re: [perl #63110] Memory leak with /ee and use feature

Thread Previous
From:
Bram
Date:
February 9, 2009 04:35
Subject:
Re: [perl #63110] Memory leak with /ee and use feature
Message ID:
20090209133526.k99pd2rc0kss08g4@horde.wizbit.be
> Here is a test case that reproduces a memory leak. Repro instructions are
> within the introductory comment.

Easier test script:

#!/usr/bin/perl -l

use strict;
use warnings;
use feature qw(:5.10);

system("ps uh $$");
for (0 .. 100_000) {
     system("ps uh $$") if $_ % 10_000 == 0;
     my $s = "a";
     $s =~ s/a/qq("aa")/ee;
}
system("ps uh $$");

__END__
$ perl-5.10.0 rt-63110.pl
bram     25508  0.0  0.0   3304  1644 pts/0    S+   13:31   0:00  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508  0.0  0.0   3304  1652 pts/0    S+   13:31   0:00  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 25.0  0.1   5416  3752 pts/0    S+   13:31   0:00  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 49.0  0.1   7396  5828 pts/0    S+   13:31   0:00  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 73.0  0.2   9508  7912 pts/0    S+   13:31   0:00  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 97.0  0.3  11620  9992 pts/0    S+   13:31   0:00  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 60.5  0.3  13732 12072 pts/0    S+   13:31   0:01  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 73.0  0.4  15844 14152 pts/0    S+   13:31   0:01  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 85.5  0.5  17824 16232 pts/0    S+   13:31   0:01  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 97.5  0.5  19936 18312 pts/0    S+   13:31   0:01  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 73.3  0.6  22048 20396 pts/0    S+   13:31   0:02  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 81.3  0.7  24160 22472 pts/0    S+   13:31   0:02  
/opt/perl/bin/perl5100 rt-63110.pl
bram     25508 81.3  0.7  24160 22472 pts/0    S+   13:31   0:02  
/opt/perl/bin/perl5100 rt-63110.pl


Two things affect the memory leak:
- use feature
- /ee: if /e is used there is no leak


(I also reproduced this on blead but the one that is tested is a  
fairly old blead... (.patch = 34076))


Kind regards,

Bram



Thread Previous


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