diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-11-22 09:20:06 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-11-22 09:20:06 +0900 |
| commit | 07b8a5b0427c21518c7b7cf465197dc310b9d3b0 (patch) | |
| tree | bb55a8c8595ed5b8bc95a6792e0d218014c2f4c9 /include/mruby.h | |
| parent | b723f67b8b271ee2ace40db723d8eeff5a70f270 (diff) | |
| download | mruby-07b8a5b0427c21518c7b7cf465197dc310b9d3b0.tar.gz mruby-07b8a5b0427c21518c7b7cf465197dc310b9d3b0.zip | |
Make mrb->arena variable sized. Use MRB_GC_FIXED_ARENA for old behavior.
You will not see "arena overflow" error anymore, but I encourage gem authors
to check your gems with MRB_GC_FIXED_ARENA to avoid memory broat.
Diffstat (limited to 'include/mruby.h')
| -rw-r--r-- | include/mruby.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/mruby.h b/include/mruby.h index e70487f27..882ba4e07 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -46,8 +46,8 @@ struct mrb_state; typedef void* (*mrb_allocf) (struct mrb_state *mrb, void*, size_t, void *ud); -#ifndef MRB_ARENA_SIZE -#define MRB_ARENA_SIZE 100 +#ifndef MRB_GC_ARENA_SIZE +#define MRB_GC_ARENA_SIZE 100 #endif typedef struct { @@ -128,7 +128,12 @@ typedef struct mrb_state { struct heap_page *sweeps; struct heap_page *free_heaps; size_t live; /* count of live objects */ - struct RBasic *arena[MRB_ARENA_SIZE]; /* GC protection array */ +#ifdef MRB_GC_FIXED_ARENA + struct RBasic *arena[MRB_GC_ARENA_SIZE]; /* GC protection array */ +#else + struct RBasic **arena; /* GC protection array */ + int arena_capa; +#endif int arena_idx; enum gc_state gc_state; /* state of gc */ |
