develooper Front page | perl.perl5.porters | Postings from February 2013

Re: PL_sv_objcount

Thread Previous | Thread Next
From:
Steffen Mueller
Date:
February 28, 2013 06:58
Subject:
Re: PL_sv_objcount
Message ID:
512EFFF8.3000601@cpan.org
On 02/27/2013 08:11 PM, Nicholas Clark wrote:
> So yes, good catch. It's going to be non-zero for any meaningful program.

Alas, removing it (see branch smueller smueller/killsvobjcount2), makes 
the following test in t/op/stash.t fail. My hunch is that it's 
uncovering another bug?

# Used to warn
# Unbalanced string table refcount: (1) for "A::" during global destruction.
# for ithreads.
{
     local $ENV{PERL_DESTRUCT_LEVEL} = 2;
     fresh_perl_is(
		  'package A; sub a { // }; %::=""',
		  '',
		  '',
		  );
}

This fails as follows:

perl: sv.c:557: do_curse: Assertion `((svtype)((_gvgp)->sv_flags & 
0xff)) == SVt_PVGV || ((svtype)((_gvgp)->sv_flags & 0xff)) == SVt_PVLV\' 
failed.
Aborted (core dumped)

This is coming from the expansion of GvGP in this code:

static void
do_curse(pTHX_ SV * const sv) {
   if ((PL_stderrgv && GvGP(PL_stderrgv) && (SV*)GvIO(PL_stderrgv) == sv)
    || (PL_defoutgv && GvGP(PL_defoutgv) && (SV*)GvIO(PL_defoutgv) ==sv))
     return;
   (void)curse(sv, 0);
}

I can make it fail *without* my changes by loading Exporter in the test 
code:

# Used to warn
# Unbalanced string table refcount: (1) for "A::" during global destruction.
# for ithreads.
{
     local $ENV{PERL_DESTRUCT_LEVEL} = 2;
     fresh_perl_is(
		  'use Exporter; package A; sub a { // }; %::=""',
		  '',
		  '',
		  );
}

I'm willing to poke at this, but the global destruction logic is 
daunting. So I'm very willing to concede this to somebody else or accept 
any kind of advice and support.

--Steffen

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