From: Paul Brannan Date: 2002-09-26T00:37:31+09:00 Subject: Re: Object-Oriented struct Model in C On Wed, Sep 25, 2002 at 11:43:01PM +0900, William Djaja Tjokroaminata wrote: > Paul Brannan wrote: > > You don't really need references to all the inner the objects on the > > stack; you could have a reference to an object that holds references to > > all your inner objects. > > But at any level, if that object that holds references to the inner > objects was not created using Data_Wrap_Struct(), there is no way for it > to mark the inner objects, is there? I think so. > Actually, what is the meaning of "registering B"? Is it > rb_gc_register_address()? I am assuming here only the Top object is > created using Data_Wrap_Struct(). (If we use rb_gc_register_address(), > doesn't it mean that we don't need any mark function? We then just need > to rb_gc_unregister_address() when the C destructor is called.) When I speak of creating an object, I mean allocating the memory for the object's data (when I think of an object, I think of a C++ object, not the entity that the VALUE is pointing to). When I speak of registering an object with the garbage collector, I mean wrapping it with a Ruby object. The gargage collector then knows it is there and knows that the object must at some point be freed. It's confusing, because there are two objects (the RObject and the object that is being wrapped), and those objects act as a single unit. I can use clearer wording if I have better words to use. Paul