[前][次][番号順一覧][スレッド一覧]

ruby-changes:60384

From: Nobuyoshi <ko1@a...>
Date: Fri, 13 Mar 2020 21:52:06 +0900 (JST)
Subject: [ruby-changes:60384] a9284ecb90 (ruby_2_7): Disable GC until VM objects get initialized [Bug #16616]

https://git.ruby-lang.org/ruby.git/commit/?id=a9284ecb90

From a9284ecb90176b4d8e9aa264da14ea08931be48f Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 9 Feb 2020 16:41:56 +0900
Subject: Disable GC until VM objects get initialized [Bug #16616]


diff --git a/gc.c b/gc.c
index 4704925..8f2b8a4 100644
--- a/gc.c
+++ b/gc.c
@@ -1589,6 +1589,7 @@ rb_objspace_alloc(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L1589
     malloc_limit = gc_params.malloc_limit_min;
     list_head_init(&objspace->eden_heap.pages);
     list_head_init(&objspace->tomb_heap.pages);
+    dont_gc = TRUE;
 
     return objspace;
 }
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index f8127d8..30a3cc7 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -1150,6 +1150,7 @@ q.pop https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L1150
                     "0 thread_machine_stack_size")
     assert_operator(h_default[:thread_machine_stack_size], :<=, h_large[:thread_machine_stack_size],
                     "large thread_machine_stack_size")
+    assert_equal("ok", invoke_rec('print :ok', 1024 * 1024 * 100, nil, false))
   end
 
   def test_vm_machine_stack_size
diff --git a/vm.c b/vm.c
index bf33d27..fc144be 100644
--- a/vm.c
+++ b/vm.c
@@ -3331,6 +3331,8 @@ Init_vm_objects(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L3331
     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 */
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]