Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Possible Memory Leak?

by davido (Archbishop)
on Apr 26, 2013 at 19:33 UTC ( #1030883=note: print w/replies, xml ) Need Help??

in reply to Possible Memory Leak?

Perl uses reference counting as its garbage collection technique. When the last reference to a given object falls out of scope, or is explicitly eradicated (as in your call to delete), the object's reference count drops to zero, and Perl is permitted to clean it up. Memory leaks typically occur when reference counts are prevented from dropping to zero, and that usually happens with self-referential or co-referential objects. If $a = \$a, then when $a falls out of scope the reference count cannot drop to zero. This is what Scalar::Util's weaken() is there to address, or object destructors that are written to break known circular cycles.

A more thorough, and community-refined explanation is available in perlref, under the section Circular References.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030883]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2018-05-28 06:10 GMT
Find Nodes?
    Voting Booth?