CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
"Attempt to free unreferenced scalar" and "Scalars leaked: 1" ?


New User

Mar 30, 2007, 9:32 AM

Post #1 of 2 (4778 views)
"Attempt to free unreferenced scalar" and "Scalars leaked: 1" ? Can't Post

Suppose we have "" and "" as follows.

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

sub c{...}

"Scalars leaked: 1" 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.

In all above cases, arguments have been initialized before creating threads. 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.).

So, is this a problem of my script or a bug or some friendly message that can be safely ignored? Any comments? Thanks!


perl v5.8.8 built for i686-linux-thread-multi
2.6.15-gentoo linux

(This post was edited by licht on Mar 30, 2007, 10:06 AM)


Mar 30, 2007, 9:46 AM

Post #2 of 2 (4777 views)
Re: [licht] "Attempt to free unreferenced scalar" and "Scalars leaked: 1" ? [In reply to] Can't Post

I don't know myself, if you ask on perlmonks you will probably get a good explanation:


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives