зеркало из https://github.com/github/ruby.git
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.
This commit is contained in:
Родитель
fee5cde00b
Коммит
22dbbbeb32
2
gc.c
2
gc.c
|
@ -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();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче