Skip Menu |

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

Report information
The Basics
Id: 34740
Status: resolved
Priority: 0/
Queue: XML-RAI

People
Owner: Nobody in particular
Requestors: mark [...] glines.org
Cc:
AdminCc:

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



Subject: [PATCH] XML::RAI::Object leaks memory!
Date: Mon, 7 Apr 2008 09:51:53 -0700
To: bug-XML-RAI [...] rt.cpan.org
From: Mark Glines <mark [...] glines.org>
Hi, It seems XML::RAI leaks a few thousand scalars every time I run XML::RAI->parse_string(). I am using it in a long-running process, whose memory was noticeably increasing over time, so this is a bad thing. To test it, I wrote the attached test script. It uses XML::RAI to parse the (also attached) rss.xml, and it uses Devel::Leak to show how many new objects were created (and not freed) after 10 invocations of that. Without the patch, I get: % perl test.pl 2>&1 | grep ^new | wc -l 31521 With the patch, I get: % perl test.pl 2>&1 | grep ^new | wc -l 312 Please consider applying this patch, it seems to help a lot. It will also require adding Task::Weaken to the list of dependencies, in Makefile.PL. Thanks, Mark

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Download rss.xml
application/xml 12.7k

Message body not shown because it is not plain text.

From: tima [...] cpan.org
What version of XML::Elemental are you running. XML::RAI uses Elemental through XML::RSS::Parser. A couple of months back I found a memory leak in Elemental and repaired it. Could you install the latest version of Elemental and see if that addresses the problem?
Subject: Re: [rt.cpan.org #34740] [PATCH] XML::RAI::Object leaks memory!
Date: Mon, 7 Apr 2008 10:25:04 -0700
To: bug-XML-RAI [...] rt.cpan.org
From: Mark Glines <mark [...] glines.org>
On Mon, 07 Apr 2008 13:13:59 -0400 "Timothy Appnel via RT" <bug-XML-RAI@rt.cpan.org> wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=34740 > > > What version of XML::Elemental are you running. XML::RAI uses > Elemental through XML::RSS::Parser. A couple of months back I found a > memory leak in Elemental and repaired it. Could you install the > latest version of Elemental and see if that addresses the problem?
I saw that too, and upgrading to XML::Elemental 2.1 fixed that. (Thanks for repairing that one, by the way.) So now when I use XML::RSS::Parser directly (and XML::Elemental indirectly), I no longer see a leak there. What I'm reporting here is a different leak, and is specific to XML::RAI; some circular references from XML::RAI::Object are preventing garbage collection. My patch seems to fix it; please take a look and see if you agree. Mark
I understand where you are coming from now. I didn't realize you where aware of the Elemental leak and that this was something different. Will put it on my plate for review. Thanks for your time and the patch! <tim/>
This patch has (finally) been committed and released in to CPAN. Thanks.