From 8ebb5e23ebc5f1675e3479b9a29f124dc458226b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 9 Mar 2021 16:29:50 +0900 Subject: [PATCH] Keep GC disabled until VM bootstrap has done [Bug #17583] --- test/ruby/test_thread.rb | 4 +++- vm.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index a75d42b962..19a3529005 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -1146,7 +1146,9 @@ q.pop env = {} env['RUBY_THREAD_VM_STACK_SIZE'] = vm_stack_size.to_s if vm_stack_size env['RUBY_THREAD_MACHINE_STACK_SIZE'] = machine_stack_size.to_s if machine_stack_size - out, = EnvUtil.invoke_ruby([env, '-e', script], '', true, true) + out, err, status = EnvUtil.invoke_ruby([env, '-e', script], '', true, true) + assert_not_predicate(status, :signaled?, err) + use_length ? out.length : out end diff --git a/vm.c b/vm.c index 3963d67168..b12021668c 100644 --- a/vm.c +++ b/vm.c @@ -3669,6 +3669,8 @@ Init_VM(void) * The Binding of the top level scope */ rb_define_global_const("TOPLEVEL_BINDING", rb_binding_new()); + + rb_objspace_gc_enable(vm->objspace); } vm_init_redefined_flag(); @@ -3734,8 +3736,6 @@ Init_vm_objects(void) vm->mark_object_ary = rb_ary_tmp_new(128); vm->loading_table = st_init_strtable(); vm->frozen_strings = st_init_table_with_size(&rb_fstring_hash_type, 10000); - - rb_objspace_gc_enable(vm->objspace); } /* top self */