Subject: | Leaks like a mofo |
It leaks memory. You have circular references.
Attached is a test case that shows the leak and the output of stderr and
stdout redirected into a file.
One of the circular references is your fault, the other is your
ascendant class (XML::SAX::Expat). To get an OO like functionality
implemented, the author stored a reference of $self into $expat->{__XSE}
(instead of passing along a weaken reference into the user data portion
to be used in callbacks like he is supposed to do). I am going to submit
a bug report with him.
If you want your code functional until he can do a new release, you need
to weaken two references:
$p->{_expat_nb_obj};
and
$p->{_xml_parser_obj}->{__XSE};
As it stands, I can't do a release of POE::Component::Jabber because of
the leaking issue (POE::Filter::XML is instantiated upon reconnect which
in turn instantiates a new parser, which means every reconnect means
POE::Component::Jabber leaks memory).
Thanks
Subject: | test_leak_filter.pl |
use warnings;
use strict;
use POE::Filter::XML::Handler;
use XML::SAX::Expat::Incremental;
use Devel::Leak;
use Devel::Cycle;
my $handler = POE::Filter::XML::Handler->new();
for(0..100)
{
my $parser = XML::SAX::Expat::Incremental->new('Handler' => $handler);
$parser->parse_string('');
eval { $parser->parse_done(); };
warn Devel::Leak::NoteSV(my $foo);
find_cycle($parser);
}
Subject: | stderr.log |
Message body not shown because it is not plain text.