Commit a44cc14e authored by h2so5's avatar h2so5

Fix extended arena check in gc_protect

parent e8dd8180
......@@ -370,17 +370,19 @@ mrb_free_heap(mrb_state *mrb)
static void
gc_protect(mrb_state *mrb, struct RBasic *p)
{
if (mrb->arena_idx >= MRB_GC_ARENA_SIZE) {
#ifdef MRB_GC_FIXED_ARENA
if (mrb->arena_idx >= MRB_GC_ARENA_SIZE) {
/* arena overflow error */
mrb->arena_idx = MRB_GC_ARENA_SIZE - 4; /* force room in arena */
mrb_raise(mrb, E_RUNTIME_ERROR, "arena overflow error");
}
#else
if (mrb->arena_idx >= mrb->arena_capa) {
/* extend arena */
mrb->arena_capa *= 1.5;
mrb->arena = (struct RBasic**)mrb_realloc(mrb, mrb->arena, sizeof(struct RBasic*)*mrb->arena_capa);
#endif
}
#endif
mrb->arena[mrb->arena_idx++] = p;
}
......
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