1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Incremental sweeping should not require page allocation

Incremental sweeping should sweep until we find a slot for objects to
use.  `heap_increment` was adding a page to the heap even though we
would sweep immediately after.

Co-authored-by: John Hawthorn <john@hawthorn.email>
This commit is contained in:
Aaron Patterson 2020-12-01 15:15:14 -08:00 committed by Aaron Patterson
parent 12a121cc0f
commit 0bebea985d
Notes: git 2020-12-03 01:24:11 +09:00

5
gc.c
View file

@ -1911,6 +1911,8 @@ heap_page_create(rb_objspace_t *objspace)
static void
heap_add_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
{
/* Adding to eden heap during incremental sweeping is forbidden */
GC_ASSERT(!(heap == heap_eden && heap->sweeping_page));
page->flags.in_tomb = (heap == heap_tomb);
list_add(&heap->pages, &page->page_node);
heap->total_pages++;
@ -5095,9 +5097,6 @@ gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap)
unsigned int lock_lev;
gc_enter(objspace, "sweep_continue", &lock_lev);
if (objspace->rgengc.need_major_gc == GPR_FLAG_NONE && heap_increment(objspace, heap)) {
gc_report(3, objspace, "gc_sweep_continue: success heap_increment().\n");
}
gc_sweep_step(objspace, heap);
gc_exit(objspace, "sweep_continue", &lock_lev);
}