Re: XML::Twig - Memory usage problem

mirod <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
howard chen wrote:

> On Wed, Nov 5, 2008 at 1:07 AM, mirod <[email protected]> wrote:
>> If your XML includes id attributes, you can either use the id => undef option
>> when you create the twig, or use the updated version on my site.
> 
> Are you sure problem only exist with "id attributes" ? I don't have
> the "id" attribute in my example XML provided. (In fact, no attributes
> used at my XML),
> However, I do have a node called "company_id". Don't know if it is related.

It is not related. It's really only with an id attribute.

When there are id attributes in the XML (given by the id option or just 'id' by 
default), then XL::Twig keeps a hash { id => element } . This way you can get 
efficiently the element from the id, using elt_id (or getElementById) on the 
twig. The value, the reference to the element, is weakened, so this doesn't 
prevent the element to be destroyed by a purge, but the entry in the hash 
remained, which can add up to quite a bit of wasted memory after a while.

If you don't have id's, then I still haven't been able to reproduce the leak. 
Back to the drawing board I guess.

-- 
mirod
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.