Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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.


Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030883]
help
Chatterbox?
[Corion]: I think there's always some Dell coupon around, at least I got one the last two times I bought a machine from them
[1nickt]: I have been an apostate in the Apple orchard for almost 15 years. But Dells are still high quality it seems, unlike Macs these days.
[1nickt]: And you can still configure the system at will, on the "Small Business" site.

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2017-03-27 12:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.