Hey all - I'm trying to determine if I'm doing something wrong, or if I've stumbled upon an actual bug. I'm trying to use HTML::TableExtract to parse a directory of html files, and I noticed that the memory footprint continues to grow as the process runs. I think I've nailed the problem down to TableExtract not properly destroying the TreeBuilder object or something. I know that the problem doesn't occur when I use TableExtract in its HTML::Parser mode. Here's my test code:
#!/usr/bin/perl use HTML::TableExtract qw(tree); my $table = "<table>" . "<tr><td>1</td><td>2</td></tr>" x 100 . "</tab +le>"; my $html = "<html><body>" . $table x 3 . "</body></html>"; foreach ( my $x = 0; $x <= 20; $x++) { my $p = HTML::TableExtract->new(); $p->parse($html); $p->eof; $p->delete; if (-f "/proc/$$/statm") { my $mem = `cat /proc/$$/statm`; $mem =~ s/^(\d+).*/$1/s; print "$x: $mem\n"; } }
Am I just doing something dumb, or should I go ahead and file a bug report? Thanks!

In reply to Possible Memory Leak in HTML::TableExtract by michalgm

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.