diff --git a/gc/default.c b/gc/default.c index 65aacb70a36148..ee242bbae697bf 100644 --- a/gc/default.c +++ b/gc/default.c @@ -2164,9 +2164,11 @@ heap_prepare(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap /* Do steps of incremental marking or lazy sweeping. */ gc_continue(objspace, size_pool, heap); - if (heap->free_pages == NULL && - !heap_page_allocate_and_initialize(objspace, size_pool, heap)) { - rb_bug("cannot create a new page after major GC"); + if (heap->free_pages == NULL) { + heap_page_allocate_and_initialize_force(objspace, size_pool, heap); + if (heap->free_pages == NULL) { + rb_bug("cannot create a new page after major GC"); + } } } }