diff options
| author | h2so5 <[email protected]> | 2014-01-02 18:23:26 +0900 |
|---|---|---|
| committer | h2so5 <[email protected]> | 2014-01-02 18:23:26 +0900 |
| commit | a44cc14e1c0eadcd823b6e91c54948dcb273c174 (patch) | |
| tree | a6883a0b2026f78b6dbe7ea0eaa5e32e5e95e483 | |
| parent | e8dd8180baae425c893e1054368a4c32c99ea805 (diff) | |
| download | mruby-a44cc14e1c0eadcd823b6e91c54948dcb273c174.tar.gz mruby-a44cc14e1c0eadcd823b6e91c54948dcb273c174.zip | |
Fix extended arena check in gc_protect
| -rw-r--r-- | src/gc.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; } |
