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

Re: [perl #75176] Symbol::delete_package does not free certain memory associated with package::ISA

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
August 2, 2010 02:34
Subject:
Re: [perl #75176] Symbol::delete_package does not free certain memory associated with package::ISA
Message ID:
20100802093414.GO48531@plum.flirble.org
On Sun, Aug 01, 2010 at 12:17:36PM -0700, Father Chrysostomos wrote:

[snip pathological but interesting example]

> The flags on SVs seem to be a rather crowded space. Am I right in thinking hashes cannot have get-magic? If that is the case, I can re-use SVs_GMG for this purpose.

I don't know with 100% certainty, but I see tests on SvGMAGICAL() in hv.c,
this in mg.c:

		if (vtbl->svt_get && !(mg->mg_flags & MGf_GSKIP))
		    SvGMAGICAL_on(sv);


and magic vtables in perl.h which have the svt_get function pointer set, such
as

MGVTBL_SET(
    PL_vtbl_sigelem,
    MEMBER_TO_FPTR(Perl_magic_getsig),
    MEMBER_TO_FPTR(Perl_magic_setsig),
    0,
    MEMBER_TO_FPTR(Perl_magic_clearsig),
    0,
    0,
    0,
    0
);


so I'm assuming that yes, it is used.
To the best of my knowledge there are no free flag bits on PVHV, and no more
that can be scavenged.

> And then each stash needs to know its effective name, as opposed to its original name (see the last line of the script above). What would be the best way to do this? Store it in magic?

Having any magic on all stashes is a measurable performance hit. For a while
in 5.9.x there was magic on stashes to store weak reference backreferences
(no vtable actions for get or set) and that was enough to slow things down.
That's why there's all the "extra" code to allow hashes to store backreferences
in the hv_aux structure. I believe that that's the logical place to hang any
extra data needed for this.

Also, if it's easier to implement, I don't see a problem with using the global
sub generation counter to flag when someone has directly manipulated the tree
of stashes. It's not common, and I don't see an absolute need to calculate the
strict set of packages affected, and call mro_changed_in() for just them.

Nicholas Clark

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