Is this section of perl_destruct meant to cause the systematic destruction
of the symbol table?
/* Prepare to destruct main symbol table. */
hv = PL_defstash;
PL_defstash = 0;
SvREFCNT_dec(hv);
Because it doesn't - the symbol table is full of typeglobs, each of which
owns a reference back to its stash. So because of this circular reference
loop the reference count of %main:: (and every other stash) is nicely positive,
and no stashes or typeglobs get destroyed until
/* Now absolutely destruct everything, somehow or other, loops or no. */
SvFLAGS(PL_fdpid) |= SVTYPEMASK; /* don't clean out pid table
now */
SvFLAGS(PL_strtab) |= SVTYPEMASK; /* don't clean out strtab now */
/* the 2 is for PL_fdpid and PL_strtab */
while (PL_sv_count > 2 && sv_clean_all())
;
which I don't think was the plan.
Am I right in
a: My assessment of what's actually happening
b: My assessment that this is not what was intended
Nicholas Clark