From c3eac4fe5cd623a8d19da5149cd07f04d31d038e Mon Sep 17 00:00:00 2001 From: dearblue Date: Sun, 13 Mar 2022 16:28:43 +0900 Subject: [PATCH] No need to protect red objects The object in `GC_RED` does not need to be marked, and the objects connected to this object should also not need to be marked. --- src/gc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gc.c b/src/gc.c index a6ff0c588..b0885a307 100644 --- a/src/gc.c +++ b/src/gc.c @@ -448,6 +448,7 @@ mrb_gc_destroy(mrb_state *mrb, mrb_gc *gc) static void gc_protect(mrb_state *mrb, mrb_gc *gc, struct RBasic *p) { + if (is_red(p)) return; #ifdef MRB_GC_FIXED_ARENA if (gc->arena_idx >= MRB_GC_ARENA_SIZE) { /* arena overflow error */