summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gc.c b/src/gc.c
index 631f7b910..8e2072788 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -1212,12 +1212,15 @@ mrb_incremental_gc(mrb_state *mrb)
if (is_major_gc(gc)) {
size_t threshold = gc->live_after_mark/100 * MAJOR_GC_INC_RATIO;
- if (threshold > MAJOR_GC_TOOMANY) {
+ gc->full = FALSE;
+ if (threshold < MAJOR_GC_TOOMANY) {
+ gc->majorgc_old_threshold = threshold;
+ }
+ else {
+ /* too many objects allocated during incremental GC, */
+ /* instead of increasing threshold, invoke full GC. */
mrb_full_gc(mrb);
- threshold = gc->live_after_mark/100 * MAJOR_GC_INC_RATIO;
}
- gc->majorgc_old_threshold = threshold;
- gc->full = FALSE;
}
else if (is_minor_gc(gc)) {
if (gc->live > gc->majorgc_old_threshold) {