Skip Menu |

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

Report information
The Basics
Id: 20512
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: sebastian.kloska [...] snafu.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.58
  • 1.58_1
Fixed in: (no value)



Subject: Memory Leak
XML::LibXML::SAX leaks memory. I've added a test file which simply starts the libxml2 sax parser and when parsing very large xml-file (e.g. ftp://ftp.ncbi.nih.gov/pub/HomoloGene/current/homologene.xml.gz) you may see how it eats up memory. 1) I've 'NULLed' all callback pointers of xmlSAXHandlerPtr in the PSaxGethandler function, and the memory leak goes away. So it doesn't seem to have anything to do with the libxml2 parser. 2) When reactivating just the PSaxCharacters callback it reappears. 3) When calling count = perl_call_method( "characters", G_SCALAR | G_EVAL ); with the G_DISCARD flag the leak also vanishes, but as far as I understand the perlcall man page everthing regarding the perlstack (SAVETMPS, ENTRE, LEAVE etc.) seems to be fine. So it might even be a perl bug. This is with verbatim perl 5.8.8 for fedora core 5 tested on i386 and x86_64. Also testef with the 1.59 cvs-version
Subject: 31sax.t
use strict; package TestHandler; use base qw(Exporter); sub new() { my $t = shift; my $h = {'COUNT'=>0}; return bless $h,$t; } sub start_element() { my $self = shift; my $e = shift; ($self->{'COUNT'} % 100000) || print STDERR "START:'".$e->{'Name'}."\r"; $self->{'COUNT'}++; } sub end_document() { my $self = shift; my $e = shift; print STDERR "\n ** END DOC ** \n"; } package main; use Test; BEGIN { plan tests => 3 } use XML::LibXML::SAX; ok(1); my $p=new XML::LibXML::SAX(Handler => new TestHandler()); ok(1); $p->parse_file('t/test-sax.xml') || die " FAILED\n"; ok(1);
Fixed in the CVS. Thanks for the detailed report and test case! BTW, the callbacks *were* wrong (they either missed POPs, or G_DISCARD). Small leaks could also happen on errors. Petr
Subject: Re: [rt.cpan.org #20512] Resolved: Memory Leak
Date: Sat, 22 Jul 2006 11:23:32 +0200
To: bug-XML-LibXML [...] rt.cpan.org
From: Sebastian Kloska <sebastian.kloska [...] snafu.de>
via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=20512 > > > According to our records, your request has been resolved. If you have any > further questions or concerns, please respond to this message. >
is the G_DISCARD flags still missing in <snip> call_method( "comment", G_SCALAR | G_EVAL ); </snip> ? -- ********************************** Dr. Sebastian Kloska Hohenstaufenstr. 58 10781 Berlin Tel: +49-30-94883723 Handy: +49-176-24621622 e-mail: sebastian.kloska@snafu.de **********************************
On so 22.čec.2006 05:23:48, kloska wrote: Show quoted text
> via RT wrote:
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=20512 > > > > > According to our records, your request has been resolved. If you
have any Show quoted text
> > further questions or concerns, please respond to this message. > >
> is the G_DISCARD flags still missing in > > <snip> > call_method( "comment", G_SCALAR | G_EVAL ); > </snip>
Yes it was, thanks. -- Petr