Skip to content

Commit 0f01b89

Browse files
Remove hard-coded swept slots threshold
1 parent d8189ed commit 0f01b89

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
@@ -1116,6 +1116,9 @@ total_freed_pages(rb_objspace_t *objspace)
11161116
#else
11171117
#define will_be_incremental_marking(objspace) FALSE
11181118
#endif
1119+
#if GC_ENABLE_INCREMENTAL_MARK
1120+
#define GC_INCREMENTAL_SWEEP_SLOT_COUNT 2048
1121+
#endif
11191122
#define is_lazy_sweeping(objspace) (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(objspace))
11201123

11211124
#if SIZEOF_LONG == SIZEOF_VOIDP
@@ -5847,7 +5850,7 @@ gc_sweep_step(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *hea
58475850
else {
58485851
heap_add_freepage(heap, sweep_page);
58495852
swept_slots += free_slots;
5850-
if (swept_slots > 2048) {
5853+
if (swept_slots > GC_INCREMENTAL_SWEEP_SLOT_COUNT) {
58515854
break;
58525855
}
58535856
}

0 commit comments

Comments
 (0)