From: Paul Brannan Date: 2002-04-19T08:53:55+09:00 Subject: Re: GC problem in C++ extension On Fri, Apr 19, 2002 at 08:00:56AM +0900, Paul Brannan wrote: > and, in fact, I do see that if I delete line 25. How can I make sure > that the allocated Foo object gets properly destructed? Ouch, I should proofread before I post. The correct change to make to get the behavior I want is not to delete line 25, but to change: VALUE v = Data_Wrap_Struct(rb_cObject, 0, (RUBY_DATA_FUNC)Foo::free, f); to: Data_Wrap_Struct(rb_cObject, 0, (RUBY_DATA_FUNC)Foo::free, f); Why does making this change allow the object to get garbage collected? Paul