Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Attempt to free unreferenced scalar

by ikegami (Pope)
on Mar 20, 2013 at 06:47 UTC ( #1024453=note: print w/ replies, xml ) Need Help??


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

According to perldiag, this message is considered a warning.

You shouldn't be dismissing the severity. The code is accessing a freed memory!

My current theory is that the free() call is failing even when I don't see any output. Is that assumption reasonable?

Accessing freed memory can lead to a wide variety of behaviour. It's a waste of time looking at this when you already know what leads to this memory corruption (accessing a freed scalar).

So far, I have not successfully isolated the problem.

An alternate approach would be to find the commit that fixed the problem. This might give a hint how to work around the problem in the versions before it was fixed.

There are tools to bisect history to find what a problem started occurring, or in this case, stopped occurring. I don't know how easy it would be to automatically install modules as part of the process.


Comment on Re^3: Attempt to free unreferenced scalar
Re^4: Attempt to free unreferenced scalar
by tqisjim (Beadle) on Mar 20, 2013 at 15:12 UTC

    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 ;)

      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://1024453]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (14)
As of 2014-09-18 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (120 votes), past polls