立石@JAISTです。

GCへ以下のようなメソッドの追加は
どうでしょうか?


*** gc.c.orig	Tue Jul 14 02:22:19 1998
--- gc.c	Tue Jul 14 03:39:44 1998
***************
*** 44,49 ****
--- 44,51 ----
  #endif
  
  static unsigned long malloc_memories = 0;
+ static unsigned long rb_gc_malloc_limit = GC_MALLOC_LIMIT;
+ static int rb_gc_show_flag = 0;
  
  void *
  xmalloc(size)
***************
*** 55,66 ****
  	ArgError("negative allocation size (or too big)");
      }
      if (size == 0) size = 1;
! #if 0
!     malloc_memories += size;
!     if (malloc_memories > GC_MALLOC_LIMIT) {
  	gc_gc();
!     }
! #endif
      mem = malloc(size);
      if (!mem) {
  	gc_gc();
--- 57,70 ----
  	ArgError("negative allocation size (or too big)");
      }
      if (size == 0) size = 1;
! 
!     if( rb_gc_malloc_limit > 0 ){
!       malloc_memories += size;
!       if (malloc_memories > rb_gc_malloc_limit) {
  	gc_gc();
!       }
!     };
! 
      mem = malloc(size);
      if (!mem) {
  	gc_gc();
***************
*** 157,162 ****
--- 161,199 ----
      return old;
  }
  
+ VALUE
+ gc_s_limit(VALUE self)
+ {
+   return uint2inum(rb_gc_malloc_limit);
+ }
+ 
+ VALUE
+ gc_s_set_limit(VALUE self, VALUE num)
+ {
+   rb_gc_malloc_limit = num2ulong(num);
+   return Qnil;
+ }
+ 
+ VALUE
+ gc_s_show_q(VALUE self)
+ {
+   return( rb_gc_show_flag ? TRUE : FALSE );
+ }
+ 
+ VALUE
+ gc_s_show(VALUE self)
+ {
+   rb_gc_show_flag = 1;
+   return Qnil;
+ }
+ 
+ VALUE
+ gc_s_unshow(VALUE self)
+ {
+   rb_gc_show_flag = 0;
+   return Qnil;
+ }
+ 
  VALUE mGC;
  
  static struct gc_list {
***************
*** 803,808 ****
--- 840,848 ----
      if (dont_gc) return;
      dont_gc++;
  
+     if( rb_gc_show_flag )
+       fprintf(stderr,"Garbage Collect Start.\n");
+ 
      malloc_memories = 0;
  #ifdef C_ALLOCA
      alloca(0);
***************
*** 844,849 ****
--- 884,892 ----
  
      gc_sweep();
      dont_gc--;
+ 
+     if( rb_gc_show_flag )
+       fprintf(stderr,"Done.\n");
  }
  
  static VALUE
***************
*** 1060,1065 ****
--- 1103,1114 ----
      rb_define_singleton_method(mGC, "start", gc_method, 0);
      rb_define_singleton_method(mGC, "enable", gc_s_enable, 0);
      rb_define_singleton_method(mGC, "disable", gc_s_disable, 0);
+     rb_define_singleton_method(mGC, "limit", gc_s_limit, 0);
+     rb_define_singleton_method(mGC, "set_limit", gc_s_set_limit, 1);
+     rb_define_singleton_method(mGC, "limit=", gc_s_set_limit, 1);
+     rb_define_singleton_method(mGC, "show?", gc_s_show_q, 0);
+     rb_define_singleton_method(mGC, "show", gc_s_show, 0);
+     rb_define_singleton_method(mGC, "unshow", gc_s_unshow, 0);
      rb_define_method(mGC, "garbage_collect", gc_method, 0);
  
      mObSpace = rb_define_module("ObjectSpace");