From 8a4cbc733114d0a51bc324b466764d10985cbd80 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 31 May 1999 09:13:34 +0000 Subject: 990531 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index 87be51c65c..db7392d706 100644 --- a/gc.c +++ b/gc.c @@ -50,6 +50,10 @@ static void run_final(); static unsigned long malloc_memories = 0; static unsigned long alloc_objects = 0; +static int malloc_called = 0; +static int free_called = 0; + +#ifndef xmalloc void * xmalloc(size) size_t size; @@ -64,6 +68,7 @@ xmalloc(size) if (malloc_memories > GC_MALLOC_LIMIT && alloc_objects > GC_NEWOBJ_LIMIT) { rb_gc(); } + malloc_called++; mem = malloc(size); if (!mem) { rb_gc(); @@ -111,6 +116,15 @@ xrealloc(ptr, size) return mem; } +static void +xfree(x) + void *x; +{ + free_called++; + free(x); +} +#endif + /* The way of garbage collecting which allows use of the cstack is due to */ /* Scheme In One Defun, but in C this time. @@ -661,7 +675,7 @@ gc_sweep() if (p->as.basic.flags) { obj_free((VALUE)p); } - if (need_call_final && FL_TEST(p, FL_FINALIZE)) { + if (need_call_final && FL_TEST(p, FL_FINALIZE)) { p->as.free.flag = FL_MARK; /* remain marked */ p->as.free.next = final_list; final_list = p; @@ -1118,6 +1132,10 @@ rb_gc_call_finalizer_at_exit() DATA_PTR(p) && RANY(p)->as.data.dfree) (*RANY(p)->as.data.dfree)(DATA_PTR(p)); +#if 0 + else if (BUILTIN_TYPE(p)) + obj_free((VALUE)p); +#endif p++; } } -- cgit v1.2.3