Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

what is "Attempt to free unreferenced scalar"?

lichtjiang (Programmer) (OP)
18 Mar 07 11:32
I got the following message when one of my perl program exits (it runs multiple threads simultaneously, it has several variable of typess of Thread::Queue and Thread::Semaphore):

Attempt to free unreferenced scalar: SV 0x84f0c00, Perl interpreter: 0x8362c78 during global destruction.

What does this mean and how to track it? Thanks!
MikeLacey (MIS)
19 Mar 07 11:06
Hi lichtjiang,

That "sounds" like a Perl bug - Are you running the latest version?

Mike

Hardware is that part of a computer which, when you remove electrical power, doesn't go away.

Want great answers to your Tek-Tips questions? Have a look at FAQ219-2884

lichtjiang (Programmer) (OP)
20 Mar 07 1:48
Thanks.

mine is "v5.8.8 built for i686-linux-thread-multi" on gentoo linux.

there is known bug similar to this? not very sure

I will have to check my code when I have time later ...
lichtjiang (Programmer) (OP)
20 Mar 07 1:54
forgot to mention that I have 4 threads in total. 3 of them used those queues and semaphores. and there were 3 such message reports for them. no report for the remaining one, which just passed queues and semaphores as arguments.

so, more like some problem w/ my code ...
MikeLacey (MIS)
21 Mar 07 16:33
Hi lichtjiang,

How are you getting on with this?

If you're still having problems can I suggest that you write as simple and short a script as possible which shows the errors you're seeing.

This will give you a chance to see clearly where any problems might lie and will also (hopefully) give you a script short enough to be posted here should you need to.

Mike

Hardware is that part of a computer which, when you remove electrical power, doesn't go away.

Want great answers to your Tek-Tips questions? Have a look at FAQ219-2884

lichtjiang (Programmer) (OP)
22 Mar 07 11:53
Thanks. Mike. That's what I'm thinking to isolate the problem code and find out what is wrong. But just working on other things and didn't find a time for this.

I will do this and post whatever I will find later ...
lichtjiang (Programmer) (OP)
27 Mar 07 1:58
Suppose we have "A.pl" and "B.pm" as follows.

_A.pl_
...
my $dummy;
threads->create("B::c", ($dummy));
...


_B.pm_
...
sub c{...}
...

"Scalars leaked:" occurs for each ref or a hash (replace $dummy with %dummy in above script) that is passed as argument to "B::c".

"Attempt to free unreferenced scalar" always happens in above example when we pass a variable (of any type) in one process to a sub in another module when it is run as a thread.

So, is this a problem of my script or a bug or some friendly message that can be safely ignored? Any comments? Thanks!
lichtjiang (Programmer) (OP)
27 Mar 07 16:29
Forgot to mention,

"Attempt to free unreferenced scalar" happened for each thread  called in the way shown above.
MikeLacey (MIS)
28 Mar 07 8:14
Hi,

If you say:

my $dummy = 1;
threads->create("B::c", ($dummy));

does that still give you an error?

Mike

Hardware is that part of a computer which, when you remove electrical power, doesn't go away.

Want great answers to your Tek-Tips questions? Have a look at FAQ219-2884

lichtjiang (Programmer) (OP)
28 Mar 07 11:30
Yes. In all cases that either message was reported, all arguments (scalar, array, hash and their refs) passed to thread "B::c" have been initialized. In "B::c", it also doesn't matter if those arguments appear as lef-side or right-side (the semaphore and queue definitely change their content and I also tried not to use any argument in "B::c" or just print out some scalar or size of some non-scalar.).

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close