diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-04-18 00:16:01 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-04-18 00:18:03 +0900 |
| commit | 135b4773e3e58cacf102f4183ba38dcfd13ec5ca (patch) | |
| tree | 0292c39ec99571b53babc672c7fe2904f1e8039b /src/gc.c | |
| parent | 0866fa38b017f66e44278ca4d37527d99b5e71ad (diff) | |
| download | mruby-135b4773e3e58cacf102f4183ba38dcfd13ec5ca.tar.gz mruby-135b4773e3e58cacf102f4183ba38dcfd13ec5ca.zip | |
Turn off major GC mode before full GC; fix #4000
Diffstat (limited to 'src/gc.c')
| -rw-r--r-- | src/gc.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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) { |
