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
Destruction happens too late when using an INIT block #15028
Comments
From @atoomicThis clearly looks like a bug to me, but this might be a limitation I'm not aware of, as I'm able to reproduce the same issue with perl 5.14.4 or perl 5.22.0 Running this program shows that $x destruction is not happening when expecting, Note that removing the INIT block or using an eval quote inside the INIT block avoid the issue # test.pl ____________ use feature q/say/; my $ok; sub X::DESTROY { { say "x REFCNT: ", eval { B::svref_2object( \$x )->REFCNT }; say $ok ? "ok" : "not ok"; # ________________________________________
|
From @ysthOn Tue, Nov 3, 2015 at 9:33 AM, Atoomic <perlbug-followup@perl.org> wrote:
Note that this is a differerent (and non-lexical) $x.
The (non-eval) INIT block is a closure on $x, so holds a reference to it. Note that perlmod specifically says with respect to BEGIN blocks: So I'd have to say this is a limitation, not a bug. But that doesn't |
The RT System itself - Status changed from 'new' to 'open' |
From @toddrOn Tue Nov 03 09:49:28 2015, sthoenna@gmail.com wrote:
So to rephrase what we're saying here: We're saying that any variable used in an INIT block like this either needs to be weakened or will never be destroyed until global destruction? I'm inclined to say that's a problem. At the least it should be documented right? |
Migrated from rt.perl.org#126556 (status was 'open')
Searchable as RT126556$
The text was updated successfully, but these errors were encountered: