Commit 42b4060c authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

force room in arena before raising arena overflow error

parent 836fed4c
...@@ -261,21 +261,10 @@ mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls) ...@@ -261,21 +261,10 @@ mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
} }
mrb->live++; mrb->live++;
if (mrb->arena_idx > MRB_ARENA_SIZE - 4) { if (mrb->arena_idx > MRB_ARENA_SIZE) {
struct RBasic **p, **q, **e; /* arena overflow error */
mrb->arena_idx = MRB_ARENA_SIZE - 2; /* force room in arena */
p = q = mrb->arena; mrb_raise(mrb, mrb->eRuntimeError_class, "arena overflow error");
e = p + mrb->arena_idx;
while (p < e) {
if (is_white(*p))
*q++ = *p;
p++;
}
if (p == q) {
/* arena overflow error */
mrb_raise(mrb, E_TYPE_ERROR, "arena overflow error");
}
mrb->arena_idx = q - mrb->arena;
} }
mrb->arena[mrb->arena_idx++] = p; mrb->arena[mrb->arena_idx++] = p;
memset(p, 0, sizeof(RVALUE)); memset(p, 0, sizeof(RVALUE));
......
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