summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-31 09:13:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-05-31 09:13:34 +0000
commit8a4cbc733114d0a51bc324b466764d10985cbd80 (patch)
tree218dc2e4d069b9656143ab3e0de06aaa97c26209 /gc.c
parent1307f8d555235116f0f0c79b9902df9cfd4bff12 (diff)
990531
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c20
1 files changed, 19 insertions, 1 deletions
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++;
}
}