gc.c: use actual work done for debt repayment in incremental step

Decrement gc_debt by the actual number of objects processed
instead of the fixed GC_STEP_SIZE. This makes step_ratio
directly affect debt repayment: larger steps repay more debt,
naturally reducing GC invocation frequency.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-03-16 08:34:23 +09:00
parent 851da984b4
commit 309f450bab
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -1332,7 +1332,7 @@ incremental_gc_step(mrb_state *mrb, mrb_gc *gc)
break;
}
gc->gc_debt -= (mrb_int)GC_STEP_SIZE;
gc->gc_debt -= (mrb_int)result;
}
static void