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

[perl #63110] Memory leak with use feature; and s///ee

From:
Bram via RT
Date:
February 15, 2009 08:59
Subject:
[perl #63110] Memory leak with use feature; and s///ee
Message ID:
rt-3.6.HEAD-12283-1234606833-1838.63110-15-0@perl.org
On Mon Feb 09 04:35:54 2009, p5p@perl.wizbit.be wrote:
> > Here is a test case that reproduces a memory leak. Repro 
instructions are
> > within the introductory comment.
> 
> 
> Two things affect the memory leak:
> - use feature
> - /ee: if /e is used there is no leak


Did a binary search:

----Program----
#!/usr/bin/perl -l

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

my $out1 = qx(ps uh $$);
my ($mem1) = $out1 =~ m/^\S+\s+\d+\s+[\d.]+\s+[\d.]+\s+(\d+)\s+/;

for (0 .. 100_000) {
    my $s = "a";
    $s =~ s/a/qq("aa")/ee;
}

my $out2 = qx(ps uh $$);
my ($mem2) = $out2 =~ m/^\S+\s+\d+\s+[\d.]+\s+[\d.]+\s+(\d+)\s+/;

if ($mem2 > $mem1 + 2048) {
  print "not ok";
}
else {
  print "ok";
}


----Output of .../pjYRGC9/perl-5.9.3@27665/bin/perl----
ok

----EOF ($?='0')----
----Output of .../pNCKy6I/perl-5.9.3@27666/bin/perl----
not ok

----EOF ($?='0')----


http://public.activestate.com/cgi-bin/perlbrowse/p/27666

Change 27666 by nicholas@nicholas-saigo on 2006/04/01 21:17:46

	Automatically set HINT_LOCALIZE_HH whenever %^H is modified.


Kind regards,

Bram



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