Index: eval.c =================================================================== RCS file: /ruby/ruby/eval.c,v retrieving revision 1.566 diff -u -p -r1.566 eval.c --- eval.c 15 Oct 2003 06:00:57 -0000 1.566 +++ eval.c 17 Oct 2003 07:22:17 -0000 @@ -1393,6 +1393,8 @@ ruby_run() if (ruby_nerrs > 0) exit(EXIT_FAILURE); state = ruby_exec(); if (state && !ex) ex = state; +puts("program end"); +rb_gc_report(); ruby_stop(ex); } Index: gc.c =================================================================== RCS file: /ruby/ruby/gc.c,v retrieving revision 1.159 diff -u -p -r1.159 gc.c --- gc.c 6 Oct 2003 17:59:52 -0000 1.159 +++ gc.c 17 Oct 2003 07:22:17 -0000 @@ -328,6 +328,7 @@ add_heap() } #define RANY(o) ((RVALUE*)(o)) +static unsigned long num_newobject = 0; VALUE rb_newobj() { @@ -335,6 +336,7 @@ rb_newobj() if (!freelist) rb_gc(); + num_newobject++; obj = (VALUE)freelist; freelist = freelist->as.free.next; MEMZERO((void*)obj, RVALUE, 1); @@ -985,6 +987,7 @@ gc_sweep() malloc_limit += (malloc_increase - malloc_limit) * (double)live / (live + freed); if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT; malloc_increase = 0; +printf("freed = %10lu\n", freed); if (freed < FREE_MIN) { add_heap(); } @@ -1207,6 +1210,16 @@ int rb_setjmp (rb_jmp_buf); #endif /* __GNUC__ */ void +rb_gc_report() +{ + printf("malloc_limit = 0x%08lx\n", malloc_limit); + printf("malloc_increase = 0x%08lx\n", malloc_increase); + printf("freelist = 0x%08lx\n", freelist); + printf("newobj = %10lu\n", num_newobject); + num_newobject = 0; +} + +void rb_gc() { struct gc_list *list; @@ -1223,6 +1236,8 @@ rb_gc() if (during_gc) return; during_gc++; +puts("GC start"); +rb_gc_report(); init_mark_stack(); /* mark frame stack */