We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d9e6507 commit 1e3e0c7Copy full SHA for 1e3e0c7
1 file changed
test/ruby/test_gc.rb
@@ -910,4 +910,25 @@ def test_old_to_young_reference
910
assert_include ObjectSpace.dump(young_obj), '"old":true'
911
end
912
913
+
914
+ def test_finalizer_not_run_with_vm_lock
915
+ assert_ractor(<<~'RUBY')
916
+ Thread.new do
917
+ loop do
918
+ Encoding.list.each do |enc|
919
+ enc.names # takes VM Lock, can't have it held already
920
+ end
921
922
923
924
+ o = Object.new
925
+ ObjectSpace.define_finalizer(o, proc do
926
+ sleep 0.5 # finalizer shouldn't be run with VM lock, otherwise this context switch will crash
927
+ end)
928
+ o = nil
929
+ 4.times do
930
+ GC.start
931
932
+ RUBY
933
934
0 commit comments