in reply to Re: memory leak
in thread memory leak
Isn't the $obj param essentialy a hash ref? This doesn't increment the reference count in every sub does it? It should all be one reference to the same memory location, right?while($i < 20000000) { @objects = getObjects(); foreach my $obj (@objects) { SomeMethod($obj); } $i += 100; } sub SomeMethod { my $obj = shift; AnotherMethod($obj); } sub AnotherMethod { my $obj = shift; }
-------------------------------- package Obj; sub new { my $class = shift; my $name = shift; my $arrayRef = shift; my $self = { NAME => $obj, ARRAY_REF => $arrayRef }; bless $self, $class; return $self; } return 1; # ex: my $obj = new Obj("x", \@arrayOfObjects);
|
|---|