I can't help but think this may be caused by hash randomization.  Have you 
tried running this with PERL_HASH_SEED=0 ?

See https://metacpan.org/module/perlrun#PERL_HASH_SEED .


Liz
============
On Aug 23, 2012, at 7:33 PM, Shlomi Fish wrote:
> with the included script below, Devel::Leak keeps outputting different 
> pointers each time for
> the leaked SVs. This makes debugging harder. Can I have perl somehow allocate 
> the same pointers
> each time when an allocation is being requested? I don't mind rebuilding a 
> dedicated perl for that
> using perlbrew or whatever. Note that this also happens if make_trouble() is 
> as simple as
> "my $x; $x = \$x;".
> 
> Regards,
> 
> -- Shlomi Fish
> 
> # Feeding XML::LibXML with an invalid file, triggering memory leaks
> 
> use strict;
> use warnings;
> 
> use Devel::Leak;
> 
> use Encode;
> use XML::LibXML;
> 
> use Carp;
> 
> binmode STDOUT, ':encoding(UTF-8)';
> 
> check_libxml_memory();
> 
> sub check_libxml_memory {
>    print "running\n";
>    my $handle;
>    my $leaveCount = 0;
>    my $enterCount = Devel::Leak::NoteSV($handle);
>    print STDERR "\nENTER: $enterCount SVs\n";
>    {
>        make_trouble(); # Trace how loading a bad doc affects memory
>    }
>    $leaveCount = Devel::Leak::CheckSV($handle);
>    print STDERR "\nLEAVE: $leaveCount SVs\n";
> }
> 
> sub make_trouble {
>    # Tries to load a bad XML file into XML::LibXML
>    my $filenameIn = 'libxml-trouble-sample.html';
>    local $/; #Read whole file
>    open(my $FILEIN,'<', $filenameIn)
>        or die "Can't read file '$filenameIn' [$!]\n";
>    my $str = <$FILEIN>;
>    close ($FILEIN);
> 
>    # Feeds the bad file to XML::LibXML.
>    my $parser = XML::LibXML->new;
>    my $success=1;
>    # if recover is set to 0 or 1, the problem ceases to exist
>    my $doc = $parser->parse_html_string($str,
>        {recover => 2, encoding => 'UTF-8'}
>    );
> 
>    return;
> }
> 
> 1;
> 
> -- 
> -----------------------------------------------------------------
> Shlomi Fish       http://www.shlomifish.org/
> Funny Anti-Terrorism Story - http://shlom.in/enemy
> 
> What is is. Perceive It. Integrate it. Act on it. Idealize it.
>    — Leonard Peikoff
> 
> Please reply to list if it's a mailing list post - http://shlom.in/reply .

Reply via email to