Skip Menu |

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

Report information
The Basics
Id: 43757
Status: resolved
Priority: 0/
Queue: XML-Bare

People
Owner: Nobody in particular
Requestors: antonio [...] dyne.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.40
Fixed in: 0.42



Subject: serious memory leak in XML::Bare
Hi David, there is a serious memory leak in XML::Bare which prevents the module from being used in long-running programs. How to reproduce it: 1) from your distribution get feed2.xml and do: for i in $(seq 1 10); do cat feed2.xml >> /var/tmp/feed3.xml; done 2) then write the following program --- use strict; use warnings; my $xml_string; open FD, "</var/tmp/feed3.xml" or die "cannot open feed3"; while(<FD>) { $xml_string .= $_; }; close FD; for (my $i=0; $i <= 20; $i++) { my $ob = new XML::Bare ( text => $xml_string ); $ob->parse(); undef ($ob); sleep(1); } --- 3) run top 4) run the previously created program now from top you will see that the program will start leaking memory, during the last for cycles on my system that program was using 24mb of memory. Cheers Antonio
The memory issues should be resolved in the current version. Note that your undef in your example program can ( should? ) be changed to undef $ob->{'xml'}; Strictly speaking, no undef is needed at all, but I have seen cases where it makes a difference in my testing. Please let me know if you continue to have issues in the current version. If so, I will run through some more serious virtualized debugging. For now I am going to close the ticket since I did not see any response of continued issues since resolving this a while back and responding on the forum. On Sun Mar 01 17:34:56 2009, antonio wrote: Show quoted text
> Hi David, > there is a serious memory leak in XML::Bare which prevents the module > from being used in long-running programs. > > How to reproduce it: > > 1) > from your distribution get feed2.xml and do: > for i in $(seq 1 10); do cat feed2.xml >> /var/tmp/feed3.xml; done > > 2) then write the following program > > --- > use strict; > use warnings; > > my $xml_string; > open FD, "</var/tmp/feed3.xml" or die "cannot open feed3"; > while(<FD>) { $xml_string .= $_; }; > close FD; > > for (my $i=0; $i <= 20; $i++) { > my $ob = new XML::Bare ( text => $xml_string ); > $ob->parse(); > undef ($ob); > sleep(1); > } > --- > > 3) run top > 4) run the previously created program > > now from top you will see that the program will start leaking memory, > during the last for cycles on my system that program was using 24mb of > memory. > > Cheers > Antonio