From: Thomas Sondergaard Date: 2003-09-12T09:15:19+09:00 Subject: ruby gc hook - is there such a thing? > > ~Object() { > > rb_gc_unregister_address(_handle); > > free(_handle); > > } I just thought of something. This .net finalizer is called asynchronously and since ruby is not thread safe that might cause problem if ruby is traversing the linked list that the finalizer above is removing an element from. Tomorrow I will change the finalizer so it insteads adds the _handle pointer to an ArrayList that I can read from the "ruby thread" when I feel like it. A very good time to do this would be on the GC thread just before the actual GC'ing starts. Is there a gc_start_hook that I can call? I imagine something like this: GC.gc_start_hook { // calls rb_gc_unregister() for all the elements in the array list I mentioned above RubyDotNet::GcUtil.unregister_all() } Cheers, Thomas