Skip to content Skip to sidebar Skip to footer

Memory Leak In Html::treebuilder

I have some Perl code: use HTML::Parse; use HTML::FormatText; # ... my $txtFormatter = HTML::FormatText->new(); while ( ... ) { # some condition my $txt = # get from a

Solution 1:

I cannot replicate this with the following script:

#!/usr/bin/perlusestrict; usewarnings;

useFile::Slurp;
useHTML::FormatText;
useHTML::TreeBuilder;

my $formatter = HTML::FormatText->new;
my $html = read_file 'test.html';

while ( 1 ) {
    my $tree = HTML::TreeBuilder->new_from_content( $html );
    $formatter->format( $tree );
    $tree->delete;
}

I let this script run for minutes and the memory usage (in Task Manager) remained between 7,200K and 7,300K.

E:\Home> perl -v

This is perl, v5.10.1 built for MSWin32-x86-multi-thread
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2009, Larry Wall

Binary build 1006 [291086] provided by ActiveState http://www.ActiveState.com
Built Aug 24 2009 13:48:26
E:\Home> perl -MHTML::TreeBuilder -e "print $HTML::TreeBuilder::VERSION"
3.23
E:\Home> perl -MHTML::FormatText -e "print $HTML::FormatText::VERSION"
2.04

Post a Comment for "Memory Leak In Html::treebuilder"