From: Paul Brannan Date: 2002-04-19T23:50:01+09:00 Subject: Re: GC problem in C++ extension On Fri, Apr 19, 2002 at 12:00:40PM +0900, Yukihiro Matsumoto wrote: > Unfortunately, GC timing is not controllable, even if you call > GC.start explicitly, partly due to the conservative nature of Ruby's > GC. All you can expect is that destructors are called before process > termination. Hmm... if I change line 327 of gc.c from: VALUE obj; to: static VALUE obj; then my program works. It seems that the problem is rb_newobj() is keeping obj on the stack, and then I'm never writing over that location. If I add a new function to my test program: void clear_my_stack(void) { void * x = alloca(10000); memset(x, 0, 10000); } and call it after the Data_Wrap_Struct, then everything gets cleaned up properly (without the change to gc.c). Paul