From: "Iñaki Baz Castillo" Date: 2012-06-01T02:49:14+09:00 Subject: Re: The last question about rb_gc_register_address(): a case in which in works with dynamic memory 2012/5/31 Admin Tensor : > "Iñaki Baz Castillo" wrote in post #1062693: >>         objects = rb_ary_new(); >>         rb_gc_register_address(&objects); >> >> I really hope this is NOT possible. If not we are lost. This is, if I >> create a VALUE in C land it cannot be GC'd in next C function. Hope >> I'm right here. > > Hi, > > A long time ago (probably ten years ago) I got a reply from Matz that if > 'objects' is on the stack, then it is protected (i.e., it will not be > GC'ed). Thanks, it makes sense. Otherwise Houston we have a problem!: // Create an Array. VALUE my_array = rb_ary_new(); // GC works here and GC's my_arary... // Store it in some Hash to avoid GC. rb_hash_aset(my_hash, some_key, my_array); // BANG !!!! Obviously it cannot not be possible :) -- Iñaki Baz Castillo