From ca6ebde821991cb558003c3a1d680eaa8df3169d Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 18 Jul 2021 10:58:55 +0900 Subject: merge revision(s) 1fac99afdae2671a9ca86bead5bde4d0e2eff1b4: [Backport #18030] skip marking for uninitialized imemo_env. RUBY_INTERNAL_EVENT_NEWOBJ can expose uninitialized imemo_env objects and marking it will cause critical error. This patch skips marking on uninitialized imemo_env. See: http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20210329T183003Z.fail.html.gz Shortest repro-code is provided by mame-san. --- gc.c | 16 ++++++++++------ test/objspace/test_objspace.rb | 13 +++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) --- test/objspace/test_objspace.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/objspace/test_objspace.rb') diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 6b956e6d14..5fd41134ba 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -243,6 +243,19 @@ class TestObjSpace < Test::Unit::TestCase GC.enable end + def test_trace_object_allocations_gc_stress + prev = GC.stress + GC.stress = true + + ObjectSpace.trace_object_allocations{ + proc{} + } + + assert true # success + ensure + GC.stress = prev + end + def test_dump_flags info = ObjectSpace.dump("foo".freeze) assert_match(/"wb_protected":true, "old":true/, info) -- cgit v1.2.3