Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 11522
Status: resolved
Worked: 5 hours (300 min)
Priority: 0/
Queue: PPI

People
Owner: adamk [...] cpan.org
Requestors: m [...] perlmeister.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.902
Fixed in: (no value)



Subject: PPI 0.902 leaks memory
Hi Adam, looks like your excellent PPI module leaks memory: for(1..100000) { my $Document = PPI::Document->new(q[print "Foo!"}]); } will grow the memory footprint of the process continuously. Would be great if you could look into it. Thanks! -- Mike
Date: Thu, 17 Feb 2005 16:20:30 +1100
From: Adam Kennedy <adam [...] phase-n.com>
To: bug-PPI [...] rt.cpan.org
Subject: Re: [cpan #11522] PPI 0.902 leaks memory
RT-Send-Cc:
Yes, it just leak... sort of. More specifically, I understand the mechanism behind the leaking, and just haven't which of two potential methods to fix it with. It's a simple refcount/circular problem, and so for now you should make sure you manually ->DESTROY all Document objects when you are finished with them. for(1..100000) { my $Document = PPI::Document->new(q[print "Foo!"}]); $Document->DESTROY; } I'll leave the bug report here for now, until the final choice over circular avoidance has been made. Adam K Michael_Schilli via RT wrote: Show quoted text
> This message about PPI was sent to you by MSCHILLI <MSCHILLI@cpan.org> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=11522 > > > Hi Adam, > > looks like your excellent PPI module leaks memory: > > for(1..100000) { > my $Document = PPI::Document->new(q[print "Foo!"}]); > } > > will grow the memory footprint of the process continuously. Would be great if you could look into it. Thanks! > > -- Mike >
It looks like implementing weakening of the parent refs in PPI::XS is going to be absolutely trivial to do, so I've decided to go with compulsory weakening of %_PARENT entries for circular-leak prevention.