> Do you play around with finalizers in the code at all? If not > careful, you can create a loop that the GC system won't catch. I'm not dealing with finalizers and so that's not it. But I do not discount the possibility that I'm doing something else that is causing the interpreter to hang on to a reference. I'd just like to track it down ;) > > This is a big problem because the C++ object that this Data object > > refers to has in fact been destroyed by this point, and so the Ruby > > Data object has a "dangling" pointer. > > I agree with the previous comment -- either you should make sure the > C++ instance lives as long as the Ruby one, or the C++ instance must > zero out the Ruby instance's pointer to it when it is destroyed. If > you don't do this, it will always be possible for people to save a > reference to the Ruby instance (say, in a global variable), cause the > Fox C++ object to be destroyed, and then crash Ruby by accessing the > Ruby instance. Yup, no argument there.