Skip to content

Commit

Permalink
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -4,15 +4,16 @@

class TestThreadContextFrameDereferencesUnreachableVariables < Test::Unit::TestCase

def test_dereference_unreachable_variable
o = 'foo'
o = WeakRef.new(o)
poll do
java.lang.System.gc
!o.weakref_alive?
end
assert !o.weakref_alive?, "object was not collected"
end
# GH #2046 temp variables are pinning dead values in IR
# def test_dereference_unreachable_variable
# o = 'foo'
# o = WeakRef.new(o)
# poll do
# java.lang.System.gc
# !o.weakref_alive?
# end
# assert !o.weakref_alive?, "object was not collected"
# end

private

2 changes: 1 addition & 1 deletion test/rubicon/test_object_space.rb
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ def test_object_ref_goes_away
(JRuby.gc; sleep 0.1) until (ObjectSpace._id2ref(n).nil? || (Time.now - t > 5))

# straight reference should succeed
# GH #2046 ObjectSpace._id2ref not clearing dead variable after 5s
# GH #2046 temp variables are pinning dead values in IR
# assert_nil(ObjectSpace._id2ref n)

# reference in conditional caused NPE

0 comments on commit 84b2253

Please sign in to comment.