This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Regression test for 34394ecd - SVs that were only on the tmps stack leaked.
authorNicholas Clark <nick@ccl4.org>
Tue, 23 Feb 2010 14:23:31 +0000 (14:23 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 23 Feb 2010 14:23:31 +0000 (14:23 +0000)
t/op/threads.t

index 588b969..956102a 100644 (file)
@@ -16,7 +16,7 @@ BEGIN {
        exit 0;
      }
 
-     plan(17);
+     plan(18);
 }
 
 use strict;
@@ -225,4 +225,16 @@ print create threads sub {
  //"undef"
 EOJ
 
+# At the point of thread creation, $h{1} is on the temps stack.
+# The weak reference $a, however, is visible from the symbol table.
+fresh_perl_is(<<'EOI', 'ok', { }, 'Test for 34394ecd06e704e9');
+    use threads;
+    %h = (1, 2);
+    use Scalar::Util 'weaken';
+    $a = \$h{1};
+    weaken($a);
+    delete $h{1} && threads->create(sub {}, shift)->join();
+    print 'ok';
+EOI
+
 # EOF