mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
+3
-1
@@ -131,7 +131,9 @@ limit = (GC_STEP_SIZE / 100) * step_ratio
|
||||
```
|
||||
|
||||
With default `step_ratio = 200` and `GC_STEP_SIZE = 1024`, the
|
||||
limit is 2048 objects per step.
|
||||
limit is 2048 objects per step. After each step, `gc_debt` is
|
||||
decremented by the actual number of objects processed, so larger
|
||||
steps repay more debt.
|
||||
|
||||
When the gray stack is exhausted, the final marking phase re-marks
|
||||
the arena and global variables to catch objects created during
|
||||
|
||||
Reference in New Issue
Block a user