Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Lost anonymous subs

by kappa (Chaplain)
on Dec 09, 2004 at 15:49 UTC ( [id://413596]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Lost anonymous subs
in thread Lost anonymous subs

Please, say that the comments down there in the code are right and I will rest calm, thankful and a bit more knowledgable :)
my $code; { my @arr = (9) x 1000_000; $code = sub { @arr }; } # here @arr got out of the scope but is not freed as # there's a ref from inside $code closure # which enables $code do things with the array when called undef $code; # only now that million of nines has gone away # it always existed in exactly one copy
--kap

Replies are listed 'Best First'.
Re^5: Lost anonymous subs
by diotalevi (Canon) on Dec 09, 2004 at 16:46 UTC

    Your comments were unintelligble

    Here is what happens. Your million nines will continue to stick around as long as $code does. Once you lose the last link to $code then your million nines will also be gone.

      Looked intelligible to me. And the comments agree with what you say.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://413596]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-29 15:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found