Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: Attempt to free unreferenced scalar

by tqisjim (Beadle)
on Mar 20, 2013 at 15:12 UTC ( #1024535=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Attempt to free unreferenced scalar
in thread Attempt to free unreferenced scalar

Thanks again for the helpful response.

My understanding is that Perl will not try to free() a weak reference. But I seem to recall reading that a weak reference is copied as a strong reference. If true, that might explain everything, since the copy will trigger free() on memory already unallocated.

I'm probably out of my league, but I assume that a weak reference copy should also be weak. Is this behavior limited to 5.10 and 5.12? Certainly a neat and tidy explanation and a manageable workaround. You're probably the best resource for sanity checking that theory. And then, is it possible to confirm by rooting around the change logs?

It's always a exciting... and a little scary... to get so close to the internals ;)


Comment on Re^4: Attempt to free unreferenced scalar
Reaped: Re^5: Attempt to free unreferenced scalar
by NodeReaper (Curate) on Mar 24, 2013 at 07:21 UTC
Re^5: Attempt to free unreferenced scalar
by ikegami (Pope) on Mar 24, 2013 at 07:22 UTC

    Weak refs just cause scalars to get undefined.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2014-12-20 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls