in reply to Memory Hog Code - Where's the Pileup?

From the WWW::Mechanize FAQ:

Mech is a big memory pig! I'm running out of RAM!

Mech keeps a history of every page, and the state it was in. It actually keeps a clone of the full Mech object at every step along the way.

You can limit this stack size with the stack_depth parm in the new() constructor.

  • Comment on Re: Memory Hog Code - Where's the Pileup?

Replies are listed 'Best First'.
Re^2: Memory Hog Code - Where's the Pileup?
by Limbic~Region (Chancellor) on Nov 03, 2005 at 13:46 UTC
    perrin,
    Andy recently made a change to WWW::Mechanize for speed. The change deferred construction of certain objects of a given page until they were asked for. This could have a minor positive memory impact as well.

    Cheers - L~R

      Maybe, but this code already copies the entire page about 4 times in memory ($mech, $html, $te, $te->rows), so any large page is going to take a big hunk of RAM regardless.
        perrin,
        Sorry - miscommunication. My intention wasn't to say that this specific problem would be addressed. I was just taking the opportunity to make a general comment about the improvement of WWW::Mechanize.

        Cheers - L~R

Re^2: Memory Hog Code - Where's the Pileup?
by awohld (Hermit) on Nov 03, 2005 at 07:15 UTC
    Ahh yes, I remember before having to flush out WWW::Mech manually, there's a method for that. I'll try that and get back to you guys!