diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-02-25 11:12:03 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-05-24 15:50:57 +0100 |
commit | e42956688f2e0df936f1a42811962946e4e185bf (patch) | |
tree | 4686d0988e09cd38798fcc4f2a3cc3eacd06600d /t | |
parent | d08d57ef17162c52e2024a3ba6755f778acbc697 (diff) | |
download | perl-e42956688f2e0df936f1a42811962946e4e185bf.tar.gz |
When deleting CLONE_PARAMS, push any unreferenced SVs onto the temps stack.
Effectively this leaves the cloned-into interpreter in a consistent state.
In the cloned-from interpreter, the SV targets of non-reference owning pointers
*are* referenced and managed by other pointers. SvREFCNT() == 0 SVs in the
cloned-into interpreter result from the non-reference owning pointers being
found and followed, but the reference owning and managing pointers not being
part of the subsection of interpreter state cloned over. Hence, this change
creates reference owning pointers to this SVs on the temps stack, which ensures
that they are correctly cleaned up, and don't "leak" until interpreter
destruction. (Which might be some time away, in a persistent process.)
Diffstat (limited to 't')
-rw-r--r-- | t/op/threads.t | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/t/op/threads.t b/t/op/threads.t index 364045d995..95f5776bd3 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -116,10 +116,6 @@ print do 'op/threads_create.pl' || die $@; EOI -TODO: { - no strict 'vars'; # Accessing $TODO from test.pl - local $TODO = 'refcount issues with threads'; - # Scalars leaked: 1 foreach my $BLOCK (qw(CHECK INIT)) { fresh_perl_is(<<EOI, 'ok', { }, "threads in $BLOCK block"); @@ -129,8 +125,6 @@ foreach my $BLOCK (qw(CHECK INIT)) { EOI } -} # TODO - # Scalars leaked: 1 fresh_perl_is(<<'EOI', 'ok', { }, 'Bug #41138'); use threads; @@ -206,8 +200,8 @@ print "ok"; EOI # Another, more reliable test for the same del_backref bug: -fresh_perl_like( - <<' EOJ', qr/ok/, {}, 'No del_backref panic [perl #70748] (2)' +fresh_perl_is( + <<' EOJ', 'ok', {}, 'No del_backref panic [perl #70748] (2)' use threads; push @bar, threads->create(sub{sub{}})->join() for 1...10; print "ok"; @@ -216,10 +210,10 @@ fresh_perl_like( # Simple closure-returning test: At least this case works (though it # leaks), and we don't want to break it. -fresh_perl_like(<<'EOJ', qr/^foo\n/, {}, 'returning a closure'); +fresh_perl_is(<<'EOJ', 'foo', {}, 'returning a closure'); use threads; print create threads sub { - my $x = "foo\n"; + my $x = 'foo'; sub{sub{$x}} }=>->join->()() //"undef" |