diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-28 08:31:35 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-28 08:31:35 +0000 |
commit | 224e59c6f82c98da0d507cfae3b39c97b6769d51 (patch) | |
tree | 1e844ef7bb01533ce06310b79a92cd0c75a53ba1 /gc.c | |
parent | 1261c7e05550a72f3bb33eae75660142c6ea2a4e (diff) |
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -46,13 +46,10 @@ static void run_final(); #define GC_MALLOC_LIMIT 400000 #endif #endif -#define GC_NEWOBJ_LIMIT 10000 static unsigned long malloc_memories = 0; static unsigned long alloc_objects = 0; -static int malloc_called = 0; - static void mem_error(mesg) char *mesg; @@ -74,17 +71,16 @@ ruby_xmalloc(size) } if (size == 0) size = 1; malloc_memories += size; - if (malloc_memories > GC_MALLOC_LIMIT && alloc_objects > GC_NEWOBJ_LIMIT) { + if (malloc_memories > GC_MALLOC_LIMIT) { rb_gc(); } - malloc_called++; mem = malloc(size); if (!mem) { rb_gc(); mem = malloc(size); if (!mem) { if (size >= 10 * 1024 * 1024) { - rb_raise(rb_eNoMemError, "try to allocate too big memory"); + rb_raise(rb_eNoMemError, "tryed to allocate too big memory"); } mem_error("failed to allocate memory"); } @@ -124,7 +120,7 @@ ruby_xrealloc(ptr, size) mem = realloc(ptr, size); if (!mem) if (size >= 10 * 1024 * 1024) { - rb_raise(rb_eNoMemError, "try to re-allocate too big memory"); + rb_raise(rb_eNoMemError, "tryed to re-allocate too big memory"); } mem_error("failed to allocate memory(realloc)"); } @@ -244,7 +240,7 @@ static int heaps_length = 0; static int heaps_used = 0; #define HEAP_SLOTS 10000 -#define FREE_MIN 512 +#define FREE_MIN 4096 static RVALUE *himem, *lomem; |