Avoid invoking GC when disabled or iterating; fix #3681

parent 87cc0344
...@@ -1436,6 +1436,10 @@ gc_step_ratio_set(mrb_state *mrb, mrb_value obj) ...@@ -1436,6 +1436,10 @@ gc_step_ratio_set(mrb_state *mrb, mrb_value obj)
static void static void
change_gen_gc_mode(mrb_state *mrb, mrb_gc *gc, mrb_bool enable) change_gen_gc_mode(mrb_state *mrb, mrb_gc *gc, mrb_bool enable)
{ {
if (gc->disabled || gc->iterating) {
gc->generational = enable;
return;
}
if (is_generational(gc) && !enable) { if (is_generational(gc) && !enable) {
clear_all_old(mrb, gc); clear_all_old(mrb, gc);
mrb_assert(gc->state == MRB_GC_STATE_ROOT); mrb_assert(gc->state == MRB_GC_STATE_ROOT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment