Didn't reply to the list....
--- Begin Message ---
John Fieber wrote:
I'm curious if anyone here uses the Ruby bindings for Redland.

I do.

I ask because they appear to be broken in a serious way that would have been fixed by now if there were actually any users.

You may be right. I use them for (1) translating various proprietary data representations into OWL, and (2) special-purpose extractors that read an OWL file and produce data products (e.g., DocBook instances) from it. Both cases are simple filters that process a single input file, typically less than 20k triples. They may leak memory or otherwise misbehave in ways that don't cause a problem for a one-shot application.

I've fixed one or two bugs and found one or two others that Dave fixed.

The Ruby classes built on top of the SWIG bindings handle freeing the underlying C structures by hooking up finalizers to call the librdf_free_foo() functions, apparently with the (invalid) assumption that a finalizer is semantically the same things as a destructor, which is not the case. When using the C API, the order you call the free functions is important. The calling order of finalizers in Ruby is non-deterministic, creating all manner of problems that change their expressions at the whim of the garbage collector.

I occasionally see a warning on shutdown, something to the effect of "iterators still active"--I can't make it occur just now. That sounds like something being destroyed in the wrong order.

In the short term, I've ditched the Ruby classes and am using the SWIG interface directly. If I can find the time, I may be able to either fix or re-write the classes because they certainly would be useful. I'd be interested if anyone else has a take on this.

That's probably the right way to go. I haven't looked at the interface file, but it should be possible to set it up so that the proper destructors are called when objects are garbage-collected. Getting that exactly right with SWIG can be tricky.

Steve


--- End Message ---
_______________________________________________
redland-dev mailing list
[email protected]
http://lists.librdf.org/mailman/listinfo/redland-dev

Reply via email to