From: pseudoman4@... Date: 2006-03-13T23:53:46+09:00 Subject: Re: Extension module: Why does object get GCed? I tried adding ruby_obj to a stl vector. This doesn't work and the object is still freed. The following code works, but is ulgy as hell (and leaky :) class RefHolder { public: VALUE val; }; void BindToRubyVariable(someObject* native, char* variableName) { ... RefHolder* r = new RefHolder(); r->val = Data_Wrap_Struct(klass, 0, 0, native); rb_define_variable(variableName, &(r->val) ); } Any better ideas?