in reply to unreachable memory with a non-zero reference count
Your code makes no sense:
$retVal = $someObject->bar()->doSomething(); $retVal = \$retVal;
You overwrite $retVal immediately. Maybe you meant:
my $myVal = $someObject->bar()->doSomething(); $retVal = \$myVal; Log4perl->debug('retval: ', sub {$retVal}); return $retVal;
Then, I think you won't have a memory leak, as the only thing that's keeping $myVal alive is the reference in $retVal. When that reference goes out of scope, also $myVal will get released.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: unreachable memory with a non-zero reference count
by Pickwick (Beadle) on Jun 21, 2010 at 13:21 UTC | |
by Corion (Patriarch) on Jun 21, 2010 at 13:26 UTC | |
by Pickwick (Beadle) on Jun 21, 2010 at 13:45 UTC |