I think we need to be moving empty pages to the tomb after they become
empty.
This commit is contained in:
Aaron Patterson 2019-10-07 12:10:24 -07:00
Родитель 0a2f04e156
Коммит 058db33c5e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 953170BCB4FFAFC6
1 изменённых файлов: 9 добавлений и 4 удалений

13
gc.c
Просмотреть файл

@ -8397,10 +8397,6 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl
heap_eden->free_pages = NULL; heap_eden->free_pages = NULL;
heap_eden->using_page = NULL; heap_eden->using_page = NULL;
if (use_verifier) {
gc_verify_internal_consistency(objspace);
}
while (moved_list) { while (moved_list) {
VALUE next_moved; VALUE next_moved;
struct heap_page *page; struct heap_page *page;
@ -8413,10 +8409,19 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl
RMOVED(moved_list)->next = 0; RMOVED(moved_list)->next = 0;
page->free_slots++; page->free_slots++;
heap_page_add_freeobj(objspace, page, moved_list); heap_page_add_freeobj(objspace, page, moved_list);
if (page->free_slots == page->total_slots) {
heap_pages_freeable_pages--;
heap_unlink_page(objspace, heap_eden, page);
heap_add_page(objspace, heap_tomb, page);
}
objspace->profile.total_freed_objects++; objspace->profile.total_freed_objects++;
moved_list = next_moved; moved_list = next_moved;
} }
if (use_verifier) {
gc_verify_internal_consistency(objspace);
}
mjit_gc_exit_hook(); // unlock MJIT here, because `rb_gc()` calls `mjit_gc_start_hook()` again. mjit_gc_exit_hook(); // unlock MJIT here, because `rb_gc()` calls `mjit_gc_start_hook()` again.
} }