licht has asked for the wisdom of the Perl Monks concerning the following question:
I have 1 error and 1 warning messages (see below) for the following scripts with "A.pl" and "B.pm".
_A.pl_ ... my $dummy=1; threads->create("B::c", ($dummy)); ... _B.pm_ ... sub c{...} ...
ERROR_ "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".
WARNING_ "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? I did find there is memory leak by checking w/ valgrind, though I haven't check in very detail. Any comments?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "Attempt to free unreferenced scalar" and "Scalars leaked: 1" ?
by Joost (Canon) on Mar 31, 2007 at 00:12 UTC | |
by licht (Novice) on Mar 31, 2007 at 23:38 UTC | |
by BrowserUk (Patriarch) on Apr 01, 2007 at 02:29 UTC | |
by licht (Novice) on Apr 01, 2007 at 08:28 UTC | |
by BrowserUk (Patriarch) on Apr 01, 2007 at 09:34 UTC | |
| |
|
Re: "Attempt to free unreferenced scalar" and "Scalars leaked: 1" ?
by Khen1950fx (Canon) on Mar 30, 2007 at 23:59 UTC | |
by licht (Novice) on Mar 31, 2007 at 23:30 UTC |