Front page | perl.perl5.porters |
Postings from February 2013
Re: PL_sv_objcount
Thread Previous
|
Thread Next
From:
Nicholas Clark
Date:
February 27, 2013 19:11
Subject:
Re: PL_sv_objcount
Message ID:
20130227191131.GB5653@plum.flirble.org
On Wed, Feb 27, 2013 at 06:03:53PM +0100, Steffen Mueller wrote:
> PL_sv_objcount is a counter of objects that is inspected in exactly one
> place:
>
> if (PL_sv_objcount) {
> /*
> * Try to destruct global references. We do this first so that the
> * destructors and destructees still exist. Some sv's might remain.
> * Non-referenced objects are on their own.
> */
> sv_clean_objs();
> PL_sv_objcount = 0;
> }
>
> This is during global destruction.
>
> In general, I'd be surprised if any significant Perl program didn't have
> some silly blessed ref flying around somewhere in the symbol table. So
> this block will be entered almost all the time anyway.
I think that any significant program will have managed to get PL_patchlevel
upgraded to a version object.
Or loaded Exporter:
(gdb) p &PL_sv_objcount
$1 = (I32 *) 0x7debf0
(gdb) watch *(I32 *) 0x7debf0
Watchpoint 1: *(I32 *) 0x7debf0
(gdb) b perl_destruct
Breakpoint 2 at 0x43f09c: file perl.c, line 533.
(gdb) run -Ilib -MExporter -e0
Starting program: /home/nick/Perl/perl/perl -Ilib -MExporter -e0
Hardware watchpoint 1: *(I32 *) 0x7debf0
Old value = 0
New value = 1
Perl_sv_bless (sv=0x805148, stash=0x7e24a8) at sv.c:9703
9703 SvUPGRADE(tmpRef, SVt_PVMG);
(gdb) c
Continuing.
Hardware watchpoint 1: *(I32 *) 0x7debf0
Old value = 1
New value = 2
Perl_sv_bless (sv=0x7e1dd0, stash=0x7e24a8) at sv.c:9703
9703 SvUPGRADE(tmpRef, SVt_PVMG);
(gdb) c
Continuing.
Hardware watchpoint 1: *(I32 *) 0x7debf0
Old value = 2
New value = 1
S_curse (sv=0x814510, check_refcnt=true) at sv.c:6517
6517 return TRUE;
(gdb) c
Continuing.
Breakpoint 2, perl_destruct (my_perl=0x7e0010) at perl.c:533
533 destruct_level = PL_perl_destruct_level;
Or loaded Config ...
Hardware watchpoint 1: *(I32 *) 0x7debf0
Old value = 2
New value = 3
Perl_sv_bless (sv=0x810df8, stash=0x7f4db8) at sv.c:9703
9703 SvUPGRADE(tmpRef, SVt_PVMG);
(gdb)
Continuing.
Breakpoint 2, perl_destruct (my_perl=0x7e0010) at perl.c:533
533 destruct_level = PL_perl_destruct_level;
(gdb)
So yes, good catch. It's going to be non-zero for any meaningful program.
Nicholas Clark
Thread Previous
|
Thread Next
-
PL_sv_objcount
by Steffen Mueller
-
Re: PL_sv_objcount
by Nicholas Clark