Issue #4047 has been updated by Nobuyoshi Nakada.

Status changed from Open to Third Party's Issue

> static VALUE obj;

This object will be collected, you need register the variable or the value to prevent from GC.

> static void InitRuby4(void *t)
> {
>   (void)t;
>   VALUE c_foo = rb_const_get(rb_cObject, rb_intern("Foo"));
>   VALUE c_bar = INT2NUM(555);
    rb_gc_register_address(&obj); // this or
>   obj = rb_funcall(c_foo, rb_intern("new"), 1, c_bar);
    rb_gc_register_mark_object(obj); // this.
> }


----------------------------------------
http://redmine.ruby-lang.org/issues/show/4047

----------------------------------------
http://redmine.ruby-lang.org