Posted on 2009-02-18 13:54:30-08 by meriadoc
Memory leak?
Hello, I'm afraid I'm fairly new to Perl so apologies in advance if I'm wasting anyone's time!
I'm using XML::Bare to process a very large XML file. I am using a sub as follows:
sub get_xml_tree { my $xml = $_[0]; my $xmlhandle = new XML::Bare(text => $xml); return $xmlhandle->parse(); }
The $xml is actually just a small chunk of xml, extracted from the original 4Gb xml file one record at a time. So I'm executing this sub up to a million times.

The problem is, I'm getting a memory leak - $xmlhandle doesn't seem to free up the memory when it goes out of scope in the sub.

What am I doing wrong?

Many thanks!

Meriadoc.
Direct Responses: 10012 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.