diff options
author | Aaron Patterson <[email protected]> | 2019-10-29 08:13:38 -0700 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2019-10-29 08:13:38 -0700 |
commit | 22dbbbeb32b88708b9ea371e856c48c5d9ad3e63 (patch) | |
tree | c9090fa0971f7f87c530b09e230f72148c5385f7 /gc.c | |
parent | fee5cde00be7342dc6c00d0b0a0276d09e5252e3 (diff) |
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.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -8554,6 +8554,7 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl } 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 } heap_eden->freelist = NULL; - VALUE disabled = rb_gc_disable(); gc_update_references(objspace); if (!RTEST(disabled)) rb_gc_enable(); |