-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@ISA self-loop #11868
Comments
From @cpansprout$ ./perl -Ilib -le '@ISA = "foo"; use Scalar::Util weaken; weaken($a=\@ISA); undef *ISA; print $a' @ISA has its own loop that prevents it from being freed. It seems we need a way for the backreferences array to point to magic, not just SVs. Flags: Site configuration information for perl 5.15.6: Configured by sprout at Sat Dec 31 10:12:16 PST 2011. Summary of my perl5 (revision 5 version 15 subversion 6) configuration: Locally applied patches: @INC for perl 5.15.6: Environment for perl 5.15.6: |
From @cpansproutOn Sun Jan 15 12:43:57 2012, sprout wrote:
No, what we need is for the elements’ magic to have no reference count -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Sun Jan 15 12:43:57 2012, sprout wrote:
No, what we need is for the elements’ magic to have no reference count -- Father Chrysostomos |
@cpansprout - Status changed from 'new' to 'open' |
From @dur-randirCreated by @dur-randirThe following code leaks on bleadperl: @G::ISA = qw/F/; This is a regression - leak appeared somewhere between 5.16.3 and 5.18.0. Perl Info
|
From @jkeenanOn Wed Jan 07 15:41:34 2015, randir wrote:
I tried to run this program and it completely froze my system (Ubuntu Linux 14.04 LTS). I also tried to run this program through Porting/bisect.pl and got the same result. This is a killer! -- |
The RT System itself - Status changed from 'new' to 'open' |
From @ilmari"James E Keenan via RT" <perlbug-followup@perl.org> writes:
Well, it's a memory leak, so after a while your machine will swap itself -- |
From @dur-randirBisect leads to commit 986d39e Fix @{*ISA} autovivification It was not attaching magic to the array, preventing subsequent changes But it only exposes problem that had already been there. |
From @dur-randir*G::ISA = [] also leaks, and that originates from commit d851b12 rt #72866 - add magic to arrayrefs assigned to *Foo::ISA The fix for rt #60220 (26d68d8) updated the isa cache when an But the problem is not in the PERL_MAGIC_isa being cast on @ISA - it get it's refcount correctly not incremented by sv_magicext. Above mentioned commits just fix future per-element @ISA behaviour. Actual problem is in the per-element PERL_MAGIC_isaelem magic. It's being cast on each element separately with mg_obj = @ISA. So the more elements you get, the more refcount for @ISA grows, creating efficient circular loop. |
From @cpansproutOn Thu Jan 08 17:18:27 2015, randir wrote:
This is a duplicate of #108280. If I knew an easy way to fix it, I probably would have done so by now. I’m merging the two tickets. -- Father Chrysostomos |
From @dur-randir
Is the following method to fool inheritance cache known? If not, I'll file a separate bug report: *F::foo = sub {}; This code runs OK, but the 2nd '->foo' call is expected to fail. Besides that, currently there's no way for an XS programmer to get note of a change in a hierarchy chain for a particular package really fast. Assume we have A->B->C, and then B gets D as a parent, resulting in A->B->D hierarchy. Starting from A, the only way to note this change is to traverse the whole chain to its root, as 'mro_isa_changed_in' and likes will change meta->pkg_gen only for B and leave its children's pkg_gen intact, only recalculating caches. I tried to achieve that goal with magic on @ISA, but PL_magic_vtables is not part of the API, so I can't change it to set a global hook, and setting magic individually is never fully relied upon even in core itself (all globe *ISA assignments trigger no magic, but directly call mro_* instead), so it'd be too much work for a fickle effect. Are there any concerns for not having a way to check inheritance changes in O(1) and not O(length-of-our-linearized-isa), or am I missing some other obvious option? |
From @cpansproutOn Fri Jan 09 14:19:09 2015, randir wrote:
That I didn’t know about, so please do file a separate report. I also find this surprising, since I thought $G::ISA[0] would attach magic to the element when it is fetched.
I don’t quite understand this. Why would you start from A? If the hierarchy changes, that would happen because @B::ISA changed, and that should trigger mro_isa_changed_in on all its subclasses, too, including A. -- Father Chrysostomos |
From @dur-randir
Done as https://rt.perl.org/Public/Bug/Display.html?id=123585
I'd expect the following code to to output two different pkg_gen's, since G's grand-parent has changed, but the output is 'G->pkg_gen = 2' for both calls: use Inline C => <<'END_C'; @G::ISA=qw/H/; Are my expectations wrong? The only counter that changes is mro->cache_gen, but it changes not only for @ISA, but also for method addition/etc. |
Migrated from rt.perl.org#108280 (status was 'open')
Searchable as RT108280$
The text was updated successfully, but these errors were encountered: