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

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
Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2015-10-08 17:25 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (222 votes), past polls