On Thu, 2007-23-08 at 13:48 -0600, Charlie Savage wrote:

> I don't think your Ruby code would change at all.  Under the covers, the 
> bindings would see that you are adding root to to doc, and so the Ruby 
> object pointing to root would give up ownership.
> 
> You'd then setup a mark function for each node.  The mark function would 
> alert the Ruby garbage collector that the doc Ruby object is still in 
> use (because you have Ruby objects pointing to child nodes).
> 
> When eventually all Ruby objects pointing to nodes are no longer in use, 
> Ruby's garbage collector will collect the doc object which in turn will 
> free the libxml tree.
> 
> Seems nice and simple to me, avoids all reference counting, and 
> leverages Ruby's mark-and-sweep garbage collector.
> 
> So am I missing something?

No, I think you're right.  The more I think about this, the more I
realise that the reference counting here is a can of worms.  It could
probably be made to work but I keep seeing more and more corner cases.

So, when can you have it ready ;-)
__
Marc

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to