diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-06 08:59:41 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-06 08:59:41 +0000 |
commit | 7881363731eb4695c745b49ad67652ae8062f995 (patch) | |
tree | 2f7eca34d979d1873f34daba9cbdac950777184a /gc.c | |
parent | 3edb155cd1bab6d1c66ae2c786cfdb71d5d8113d (diff) |
* gc.c (ruby_xmalloc): remove MALLOC_LIMIT to avoid frequent
garabage collection.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 20 |
1 files changed, 1 insertions, 19 deletions
@@ -53,16 +53,6 @@ void *alloca (); #endif static void run_final(); - -#ifndef GC_MALLOC_LIMIT -#if defined(MSDOS) || defined(__human68k__) -#define GC_MALLOC_LIMIT 200000 -#else -#define GC_MALLOC_LIMIT 8000000 -#endif -#endif - -static unsigned long malloc_memories = 0; static VALUE nomem_error; void @@ -88,11 +78,7 @@ ruby_xmalloc(size) rb_raise(rb_eNoMemError, "negative allocation size (or too big)"); } if (size == 0) size = 1; - malloc_memories += size; - if (malloc_memories > GC_MALLOC_LIMIT) { - rb_gc(); - } RUBY_CRITICAL(mem = malloc(size)); if (!mem) { rb_gc(); @@ -129,7 +115,6 @@ ruby_xrealloc(ptr, size) } if (!ptr) return xmalloc(size); if (size == 0) size = 1; - malloc_memories += size; RUBY_CRITICAL(mem = realloc(ptr, size)); if (!mem) { rb_gc(); @@ -1131,15 +1116,12 @@ rb_gc() SET_STACK_END; if (dont_gc || during_gc) { - if (!freelist || malloc_memories > GC_MALLOC_LIMIT) { - malloc_memories = 0; + if (!freelist) { add_heap(); } return; } - malloc_memories = 0; - if (during_gc) return; during_gc++; |