From: ts Date: 2001-12-29T00:08:24+09:00 Subject: [ruby-talk:29533] Re: GC and values in extensions >>>>> "P" == Paul Brannan writes: P> VALUE foo(VALUE self) { P> VALUE x = rb_str_new2("foo"); P> long y = (long)x; /* Assume x and y now have the same bit pattern */ P> x = Qnil; P> ... P> return Qnil; P> } Well a better example is VALUE tt(self) VALUE self; { VALUE x = rb_str_new2("foo"); return rb_funcall(self, rb_intern("uu"), 1, x); } rb_funcall() can call rb_gc(), if x is not marked you can have problems. P> This also sounds a little inefficient to me (though it makes things P> convenient for extension writers). Is it? Your example is a little pathological :-)) but it make thing very convenient for extension writers (and also for ruby). It's really pleasant to write extension in ruby unlike in other P languages (where you must manage a reference count or something like this) Guy Decoux