ruby-changes:58501
From: Aaron <ko1@a...>
Date: Wed, 30 Oct 2019 00:14:03 +0900 (JST)
Subject: [ruby-changes:58501] 22dbbbeb32 (master): Compacting the heap can cause GC, so disable it
https://git.ruby-lang.org/ruby.git/commit/?id=22dbbbeb32 From 22dbbbeb32b88708b9ea371e856c48c5d9ad3e63 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Tue, 29 Oct 2019 08:13:38 -0700 Subject: Compacting the heap can cause GC, so disable it When we compact the heap, various st tables are updated, particularly the table that contains the object id map. Updating an st table can cause a GC to occur, and we need to prevent any GC from happening while moving or updating references. diff --git a/gc.c b/gc.c index 6fcdf2a..97133e6 100644 --- a/gc.c +++ b/gc.c @@ -8554,6 +8554,7 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8554 } VALUE moved_list; + VALUE disabled = rb_gc_disable(); if (use_toward_empty) { moved_list = gc_compact_heap(objspace, compare_free_slots); @@ -8563,7 +8564,6 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8564 } heap_eden->freelist = NULL; - VALUE disabled = rb_gc_disable(); gc_update_references(objspace); if (!RTEST(disabled)) rb_gc_enable(); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/