From: Hans Mackowiak Date: 2012-04-18T23:26:22+09:00 Subject: Re: C extensions: disable GC for a Ruby object and enable GC later for it rb_gc_disable() & rb_gc_enable() works global but i use an hash for storeing, mark them with rb_global_variable. and then i add the VALUE objects like this in the hash: VALUE obj; rb_hash_aset(global_evthandler,INT2NUM(obj),obj); #protect from GC rb_hash_delete(global_evthandler,INT2NUM(obj));# unprotect (as you can see i use the 'object-ID' for the hash key) -- Posted via http://www.ruby-forum.com/.