1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

rename malloc_memories to malloc_increase. [ruby-cvs:05237]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2002-10-10 17:11:18 +00:00
parent a3b6e114b4
commit 539428b0f4

10
gc.c
View file

@ -60,7 +60,7 @@ void *alloca ();
#endif
#endif
static unsigned long malloc_memories = 0;
static unsigned long malloc_increase = 0;
static unsigned long malloc_limit = GC_MALLOC_LIMIT;
static void run_final();
static VALUE nomem_error;
@ -88,9 +88,9 @@ ruby_xmalloc(size)
rb_raise(rb_eNoMemError, "negative allocation size (or too big)");
}
if (size == 0) size = 1;
malloc_memories += size;
malloc_increase += size;
if (malloc_memories > malloc_limit) {
if (malloc_increase > malloc_limit) {
rb_gc();
}
RUBY_CRITICAL(mem = malloc(size));
@ -129,7 +129,7 @@ ruby_xrealloc(ptr, size)
}
if (!ptr) return xmalloc(size);
if (size == 0) size = 1;
malloc_memories += size;
malloc_increase += size;
RUBY_CRITICAL(mem = realloc(ptr, size));
if (!mem) {
rb_gc();
@ -966,7 +966,7 @@ gc_sweep()
}
}
malloc_limit = live;
malloc_memories = 0;
malloc_increase = 0;
if (freed < FREE_MIN) {
add_heap();
}