Skip to content

Commit b5971ac

Browse files
Remove hard-coded swept slots threshold
1 parent a51f30c commit b5971ac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,9 @@ total_freed_pages(rb_objspace_t *objspace)
11121112
#else
11131113
#define will_be_incremental_marking(objspace) FALSE
11141114
#endif
1115+
#if GC_ENABLE_INCREMENTAL_MARK
1116+
#define GC_INCREMENTAL_SWEEP_SLOT_COUNT 2048
1117+
#endif
11151118
#define is_lazy_sweeping(objspace) (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(objspace))
11161119

11171120
#if SIZEOF_LONG == SIZEOF_VOIDP
@@ -5792,7 +5795,7 @@ gc_sweep_step(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *hea
57925795
else {
57935796
heap_add_freepage(heap, sweep_page);
57945797
swept_slots += free_slots;
5795-
if (swept_slots > 2048) {
5798+
if (swept_slots > GC_INCREMENTAL_SWEEP_SLOT_COUNT) {
57965799
break;
57975800
}
57985801
}

0 commit comments

Comments
 (0)