[Catalyst] Storing $c leaks memory?
Tobias Kremer
list at funkreich.de
Thu Aug 23 14:48:48 GMT 2007
While hunting down some memory leaks in my application I found that it's
generally a bad idea to store $c in a class as this never gets cleared up
completely, is that correct?
I'm also doing things like this which seem to cause major leaks:
$foo->bar( coderef => sub { return $c->forward( '/someaction' ) } );
While I can imagine that a closure like that can cause trouble I don't see why
the following is leaking memory, too:
in a Controller:
my $foo = Foo->new( $c );
in Foo.pm:
sub new {
my( $class, $c ) = @_;
my $self = {};
$self->{ '_c' } = $c;
bless $self, $class;
}
Maybe somebody can shed some light on this?! Is it possible (and sensible) to
weaken $c before storing it?
Thanks a lot!
--Tobias
More information about the Catalyst
mailing list