Skip Menu |

This queue is for tickets about the XML-Smart CPAN distribution.

Report information
The Basics
Id: 20736
Status: resolved
Priority: 0/
Queue: XML-Smart

People
Owner: Nobody in particular
Requestors: olga82 [...] gmail.com
Cc:
AdminCc:

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



Subject: memory leak in XML::Smart
Date: Fri, 28 Jul 2006 11:07:06 +0200
To: bug-XML-Smart [...] rt.cpan.org
From: Ol'ga <olga82 [...] gmail.com>
I think I discovered a memory leak in XML::Smart. Here's what I do. I have a huge text file, one complete xml structure per line (big lines!). I read from that file line by line and use XML::Smart to extract some information, change the xml structure, and write it to a new file. This means that on every iteration (for every line in my input file), I call new() with the string containing the xml ... I'm explicitly calling the destructor before doing that ($xmldep->DESTROY()) to make sure the old object doesn't linger in memory (I added it after seeing a leak, so yes, it leaks without the call to DESTROY as well). And still, I see the memory use go up up up until the script crashes. thanks, -- -ol'ga
From: artrus [...] netzero.net
I too have a feeling XML::Smart leaks memory. I load and process a lot of xml files within the same script and the memory doesn't get reclaimed when it goes out of scope. It may have something to do with dying out of an eval but there's definitely something going on here. I wish the author were alive... On Fri Jul 28 05:07:23 2006, olga82@gmail.com wrote: Show quoted text
> I think I discovered a memory leak in XML::Smart. Here's what I do. I have > a huge text file, one complete xml structure per line (big lines!). I > read from that file line by line and use XML::Smart to extract some > information, change the xml structure, and write it to a new file. This > means that on every iteration (for every line in my input file), I > call new() with the string containing the xml ... I'm explicitly > calling the destructor before doing that ($xmldep->DESTROY()) to make > sure the old object doesn't linger in memory (I added it after seeing > a leak, so yes, it leaks without the call to DESTROY as well). And > still, I see the memory use go up up up until the script crashes. > > thanks,
RT-Send-CC: artrus [...] netzero.net
The Perl interpreter never actually returns memory to the system - The assumption is that it might need it at a later point. Regarding the calling of destroy the object needs to go out of scope - It will be helpful if I had a chunk of the original code and some little part of the data you are using. I am closing this bug but if you feel otherwise please feel free to re- open it.
Memory leak confirmed.
RT-Send-CC: artrus [...] netzero.net
Fixed in 1.73 Added function ANNIHILATE to 'deeply' clean memory that XML::XPath does not clear. Please see POD for details. Please re-open if you see further memory issues.