Hi, I've beeing using WWW::Mechanize 0.71 and kept having memory leak problem. Here is an example script:
#!/usr/bin/perl use WWW::Mechanize; use Devel::Size qw(size total_size); my $agent = WWW::Mechanize->new(); while (1) { $agent->get(qq(http://www.yahoo.com)); print "agent size = ".total_size($agent)."\n"; }
This script will show that the size of the agent object keeps growing fast. Same can be verified using "top".
Changing the object type from WWW::Mechanize to LWP::UserAgent will immediately fix the leak but certainly lost all the wonderful functions Mechanize provides.
I've also tried the latest 0.71_2. Still leaks. I'm using RH9.0 with Perl 5.8.0 on my Linux box. LWP is version 5.76.
I would appreciate very much if any insight from the monks is provided. Thanks in advance.

In reply to WWW::Mechanize memory leak??? by cwchang

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.