Tobias Peters <tpeters / invalid.uni-oldenburg.de> wrote in message news:<Pine.LNX.4.44.0304101407250.13250-100000 / localhost.localdomain>...
> On 9 Apr 2003, Steve Hart wrote:
> > 1) A more detailed explanation of THE GC interaction would be good. I'
> > not sure if you need to do both marking and rb_global_variable and/or
> > rb_gc_register_address. If I call rb_ary_new2 in my C code should I
> > always inform the GC? I understand that I need to use a mark function
> > for wrapped c classes but where do I get the VALUE from to pass to the
> > mark function?
> > If I am marking and object correctly what do I do when I want to free
> > it off - just stop marking?
> 
> Please read:
> 
> http://www.rubygarden.org/ruby?GCAndExtensions
> 
>   Tobias

I did. It was useful as far as it went. What it did'nt say was how the
object created with Data_Wrap_Struct could be registered with the GC.
Neither did it mention how the interpreter marks the current stack
frame when ruby_init() is called thus enabling c side ruby objects to
be automatically marked by the GC. Knowing this then raises the
question of how to tell the GC that, if the previously created object
is retained (struct,heap etc), it should not be reaped
Finally, it does not explain how to release a retained object when
you're done.
Perhaps Simon could extend this into his tutorial.