develooper Front page | perl.perl5.porters | Postings from August 2011

[perl #98092] "Attempt to free unreferenced scalar" from dist/threads-shared/t/clone.t

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
August 31, 2011 16:36
Subject:
[perl #98092] "Attempt to free unreferenced scalar" from dist/threads-shared/t/clone.t
Message ID:
rt-3.6.HEAD-31297-1314833758-1488.98092-15-0@perl.org
On Wed Aug 31 09:34:05 2011, sprout wrote:
> Aha!
> 
> In pad.c:Perl_padlist_dup:
> 
> 	/* look for it in the table first.
> 	   I *think* that it shouldn't be possible to find it there.
> 	   Well, except for how Perl_sv_compile_2op() "works" :-(   */
> 	dstpad = (AV*)ptr_table_fetch(PL_ptr_table, srcpad);
> 
> 	if (dstpad)
> 	    return dstpad;
> 
> No SvREFCNT_inc!
> 
> commit 6de654a5795b6f7915432ff16bcdac0688492a9b
> Author: Nicholas Clark <nick@ccl4.org>
> Date:   Thu Feb 25 14:21:18 2010 +0000
> 
>     In Perl_padlist_dup() don't duplicate @_ or pads caused by recursion.
>     
>     CvDEPTH() is 0 in a new thread, so duplicating pads beyond the
> always-present
>     first level is a waste of effort and memory.
> 
> Adding SvREFCNT_inc makes one warning go away.

I tried writing a small test to reproduce this, now I know the cause (of
the first warning). I’ve given up. This is what didn’t work:

#!perl -w
use threads;
$ENV = \@DB::args;
my @foo = 1..100;
sub { package DB; () = caller(0);}->(@foo);
undef @foo;
my $sc = 100;
eval("sub{"x$sc . "async{}->join" . "}->()"x$sc . ';1') or die;

I suppose I’ll have to fix it without tests.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About