Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: XML::Twig loves to eat my memory

by AndyZaft (Hermit)
on Jul 22, 2010 at 20:17 UTC ( #850902=note: print w/replies, xml ) Need Help??


in reply to XML::Twig loves to eat my memory

I'm sure mirod will tell you sooner or later what you can do to make it better. Maybe it's just needs another purge/flush before the dispose to tell twig that it is finished with the root element too.

Replies are listed 'Best First'.
Re^2: XML::Twig loves to eat my memory
by AndyZaft (Hermit) on Jul 22, 2010 at 20:30 UTC
    Something else just occurred to me is that in this case it might be beneficial to use twig_roots since you are only interested in 1 field anyway. Probably not going to help with the memory issues much in the end, but it might crash later :)
      twig_roots does prove to be most useful for when you only want one little bit of data. A single file only consumes 19MB as opposed to 166MB. However it still does not release memory when I try to $t->dispose(). This also does not solve my problem for scripts that have to process all the data.

        However it still does not release memory when I try to $t->dispose().

        How did you ascertain that?

        Very strange, since dispose calls the Twig object's destructor explicitly. But then again I don't know much about how the GC works in the Perl process. So your memory usage keeps growing the more files you process if I'm understanding this correctly, right?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://850902]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2018-07-15 21:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (326 votes). Check out past polls.

    Notices?