List Info

Thread: Storing $c leaks memory?




Storing $c leaks memory?
country flaguser name
Germany
2007-08-23 08:48:48
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

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )