On Jul 19, 4:45 pm, Charlie Savage <[EMAIL PROTECTED]> wrote:
> They do - that's not the problem.  The problem is that Ruby ignores mark
> functions on process shutdown.  In other words, free functions are
> called in a random order.  For more details see the above thread.
>
> I view this as a shortcoming in Ruby's GC.  To work around requires
> implementing our own custom mark implementation.  Basically an xpath
> object would register a pointer to itself with its parent document.
> When the document is freed, the document checks its list of xpath object
> pointers.  In a normal running program, this will always be none because
> of mark/sweep.  In a terminating process, there may be some.  In that
> case, the document calls back to the xpath object to tell it to free its
> underlying c data.  Then when the xpath object's free function is called
> a few milliseconds later, its already freed its c data so no
> segmentation fault takes place.

I'm not skilled enough in this area to know for sure, but my gut
feeling is that there must be simpler solution.

> I can't decide if its worth the bother or not...Its clearly easier in
> Ruby to set the xpath object to nil and force a GC, but then you are
> forcing a c idiom onto a Ruby programmer.

A Ruby programmer should never have to force the GC.

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

Reply via email to