From: "Sean O'Dell" Date: 2003-09-12T06:14:19+09:00 Subject: Re: GC - PLEASE set me straight Thomas Sondergaard wrote: >>If your C/C++ object has a VALUE member, you need only register the >>address of that just once, and unregister it in the destructor. As long >>as your C/C++ object is around, the VALUE is registered and the object >>it is tied to will not go away. > > > That is exactly what I am doing I just wanted to spell out the scenario as > it may happen when there are more than one C++ wrapped reference to a ruby > object. > > I'll try that volatile thing and see if it makes a difference. Hmm ... I'm confused about that statement. If the VALUE is a member of a class, then it's probably NOT on the stack, so volatile won't help you there. In this case, just use rb_gc_register_address/rb_gc_unregister_address in your constructor/destructor methods for your C++ class. Sean O'Dell