in reply to HTML::TableExtract Memory Usage

Try $te->tree->delete; or
sub HTML::TableExtract::Table::DESTROY { eval { $_[0]->tree->delete; $_[0]->tree( undef ); }; return; }
or
my $te = HTML::TableExtract -> new( ); $te->parse ($page); $te->eof; print "$te c is $c\n"; eval { for( $te->tables ){ $_->tree->delete ; $_->tree( undef ); } $te->tree->delete; $te->tree( undef ); undef $te; 1; } or warn $@;
it might work

Replies are listed 'Best First'.
Re^2: HTML::TableExtract Memory Usage
by Anonymous Monk on Sep 03, 2010 at 00:49 UTC
    Just tried all 3 of the above scenarios, but the memory keeps ballooning :/
      I was afraid of that. There are too many circular references in that module, ie
      sub _reset_state { my $self = shift; $self->{_cdepth} = -1; $self->{_tablestack} = []; $self->{_tables} = {}; $self->{_ts_sequential} = []; $self->{_counts} = []; $self->{_in_a_table} = 0; } ... grid => [], translation => [], hrow => [], order => [], children => [],
      Would have to break all those circular references in DESTROY, recursively