diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-01-02 15:44:31 -0800 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-01-02 15:44:31 -0800 |
| commit | a26a6fecee726fa5e7adfd857a91383c6873de00 (patch) | |
| tree | e9d7f4425a8f479eea8108b0bbde3c696705f8df /src | |
| parent | 18f393013a15d940ea7dcc49b27dcbb315632b0a (diff) | |
| parent | a44cc14e1c0eadcd823b6e91c54948dcb273c174 (diff) | |
| download | mruby-a26a6fecee726fa5e7adfd857a91383c6873de00.tar.gz mruby-a26a6fecee726fa5e7adfd857a91383c6873de00.zip | |
Merge pull request #1637 from h2so5/extended-arena-size
Fix extended arena check in gc_protect
Diffstat (limited to 'src')
| -rw-r--r-- | src/gc.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -365,17 +365,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; } |
