On 28 July 2013 09:19, Father Chrysostomos via RT <perlbug-followup@perl.org> wrote: > On Sat Jul 27 17:05:39 2013, rjbs wrote: >> I received a user report along with an excellent reproducer, here >> converted to a test: >> >> use PadWalker 'peek_my'; >> use Test::More; >> >> my ($var1, $var2, $var3); >> >> our $want = { map {; $_ => \undef } qw($var1 $var2 $var3) }; >> >> sub { is_deeply( peek_my(0), $want, 'anon A' ); }- >> >(); > > That one is not a closure. It passes (serendipitously). > >> sub { is_deeply( peek_my(0), $want, 'anon B' ); $var2 }- >> >(); > > That one is. It fails. > > It was probably a0d2bbd5c470 that did it. See #89544. > > PadWalker simply follows CvOUTSIDE pointers. The problem with a closure > clone having an outside pointer is that it has to be reference-counted, > easily resulting in circularities. > > We must retain the CvOUTSIDE pointer for string eval to be able to look > up variables in the parent. But in the absence of string eval or s///ee > we try to avoid memory leaks. Also, try running it under the debugger. > It passes. > > I do not consider this a bug, because the closure does not close over > $var1 or $var3. Those variables may already have been freed by the time > you call peek_my. While I agree with your analysis I thought that PADMY vars werent freed until global destruction. Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next