[redland-dev] ruby bindings

carmen _ at whats-your.name
Tue Mar 11 04:35:58 GMT 2008


On Mon Mar 10, 2008 at 04:05:44PM -0700, John Fieber wrote:
> I'm curious if anyone here uses the Ruby bindings for Redland.

yep

>
> 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.

i noticed they leaked like hell when i used the wide range of classes available. now that i use only raptor, and mainly make raw C calls via the toplevel Redland object, its no longer an issue


> 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.

it does get freed eventually right? 

whats the Ruby way - having all API functions take a block argument, manually yielding the newly created SWIG/C resource to a block, then explicitly calling free afterwards? 

contorting your code to satisfy the garbage collector? lol


> 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.

there was a user on IRC, jargonjustin, claiming to have already largely rewritten the Ruby bindings. he's easily googlable, if you want to follow up with him..

cheers, 

C


>
> -john
>
> _______________________________________________
> redland-dev mailing list
> redland-dev at lists.librdf.org
> http://lists.librdf.org/mailman/listinfo/redland-dev


More information about the redland-dev mailing list