Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Attempt to free unreferenced scalar...

by mikfire (Deacon)
on Nov 29, 2000 at 19:55 UTC ( [id://43919]=note: print w/replies, xml ) Need Help??


in reply to Attempt to free unreferenced scalar...

The only time I have seen this error was in doing perl Gtk programming and it was usually a result of destroying an object without destroying the embedded objects first, ie, I would destroy the top window without destroying all the widgets I had embedded in it.

When perl then went to DESTROY these objects when they went out of scope, it got very unhappy about attempting to free ( the embedded object ) an unreferenced scalar ( since the referencing object was already gone ).

I am not claiming this isn't a bug, nor am I claiming this is your problem. I am merely offering my past experience hoping it may help.

Mik
mikfire

  • Comment on Re: Attempt to free unreferenced scalar...

Replies are listed 'Best First'.
Re^2: Attempt to free unreferenced scalar...
by Anonymous Monk on Sep 22, 2010 at 23:35 UTC
    I was getting this bug today and none of the pages I read helped so I figured I should post now that I figured out the problem. All pages I read indicate it's probably a perl bug itself. But for me it was due to having a foreach loop like this:

    foreach $key (keys %hash) {

    }

    with another foreach loop inside using the same variable name and same hash

    foreach $key (keys %hash) {
       foreach $key (keys %hash) {

       }
    }

    Incidentally, this only caused the problem in strict mode. I'm not saying this simple loop would replicate the problem, I got it down to about 20 lines and still throwing the error. But if you're getting this error message, look for a nested thing like that, it might be what's causing it. Perl should maybe throw a warning when a loops are nested like that with the same variables, because otherwie it was pretty hard to track down in my 1000 line program, I had to remove piece by piece until it became evident.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2024-04-16 19:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found