Hi, I'm implementing Ruby bindings for a C library and I'm encountering some problems related to the garbage collector, my objects are claimed too early. Here's the ruby code: o.some_meth.notifier do |r| do_stuff_with(r) end In the C library, functions are processed asynchronously, so everything is managed with intermediate Result objects. "some_meth" will instantiate a new "Result" object. Using this Result object, the caller can wait for the function to succeed, he can register callbacks etc. The Result objects notifier method registers a callback - its called when "some_meth" finishes, which can take some time ;) This callback might be called more than once. In my test script, I made sure the handler is called continously. By calling GC.start in the handler, I found out that the GC is claiming the Result object early, since there are no objects that are marking it. The only object that's referencing the Result object is the block at this time, and I guess it doesn't actually mark the object :) I know I can work around this by using rb_global_variable() to tell the GC not to claim the object, but this kinda sucks since the object will never be freed :( So, my question is: how do I prevent the Result object from being claimed by the GC without using rb_global_variable's? What are common workarounds for these types of problems? Is there any online documentation about the topic (besides README.EXT and the Pickaxe's section on Extending Ruby)? Thanks in advance. -- Regards, Tilman