Skip to content

Commit

Permalink
Incrementally mark even if we have free pages
Browse files Browse the repository at this point in the history
We move all pooled pages to free pages at the start of incremental
marking, so we shouldn't run incremental marking only when we have run
out of free pages. This causes incremental marking to always complete
in a single step.
  • Loading branch information
peterzhu2118 committed Aug 16, 2023
1 parent 52837fc commit da74b2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2347,15 +2347,15 @@ gc_continue(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap)
gc_enter(objspace, gc_enter_event_continue, &lock_lev);

/* Continue marking if in incremental marking. */
if (heap->free_pages == NULL && is_incremental_marking(objspace)) {
if (is_incremental_marking(objspace)) {
if (gc_marks_continue(objspace, size_pool, heap)) {
gc_sweep(objspace);
}
}

/* Continue sweeping if in lazy sweeping or the previous incremental
* marking finished and did not yield a free page. */
if (heap->free_pages == NULL && is_lazy_sweeping(objspace)) {
if (is_lazy_sweeping(objspace)) {
gc_sweep_continue(objspace, size_pool, heap);
}

Expand Down

0 comments on commit da74b2c

Please sign in to comment.