Make GCed during suppressing the warning
Consume the VM stack more, to make the target object get GCed with more probability during suppressing the warning.
This commit is contained in:
parent
5b27c1a15b
commit
ed51e8b8fa
@ -451,14 +451,17 @@ class TestGc < Test::Unit::TestCase
|
||||
result << :c2
|
||||
raise
|
||||
end
|
||||
tap {
|
||||
tap {
|
||||
gen = proc do |depth|
|
||||
if depth > 0
|
||||
gen[depth-1]
|
||||
else
|
||||
obj = Object.new
|
||||
ObjectSpace.define_finalizer(obj, c1)
|
||||
ObjectSpace.define_finalizer(obj, c2)
|
||||
obj = nil
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
gen[100]
|
||||
EnvUtil.suppress_warning {GC.start}
|
||||
skip "finalizers did not get run" if result.empty?
|
||||
assert_equal([:c1, :c2], result)
|
||||
@ -474,14 +477,17 @@ class TestGc < Test::Unit::TestCase
|
||||
@result << :c2
|
||||
raise
|
||||
end
|
||||
tap {
|
||||
tap {
|
||||
gen = proc do |depth|
|
||||
if depth > 0
|
||||
gen[depth-1]
|
||||
else
|
||||
obj = Object.new
|
||||
ObjectSpace.define_finalizer(obj, method(:c1))
|
||||
ObjectSpace.define_finalizer(obj, method(:c2))
|
||||
obj = nil
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
gen[100]
|
||||
EnvUtil.suppress_warning {GC.start}
|
||||
skip "finalizers did not get run" if @result.empty?
|
||||
assert_equal([:c1, :c2], @result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user