On Fri, 25 Nov 2011 13:51:55 +0000
Norman Gray <[email protected]> wrote:

> 
> Maxence, hello.
> 
> On 25 Nov 2011, at 13:04, Maxence Guesdon wrote:
> 
> > Thanks for your explanation. If I understand correctly:
> > - there is smal additional cost (memory and cpu) due to copying,
> 
> Well yes, but no more than would be expected anyway in normal operation.  A 
> GC-based implementation would have object creating and copying being very 
> cheap anyway.
> 
> > - sharing is prevented.
> 
> I'm not sure what you mean here.  When the wrapper layer copies a librdf 
> object it's done via a librdf function call, as Lauri mentioned.  In many 
> cases this will be implemented by incrementing a librdf-internal reference 
> count, which means very little cost; and this wouldn't prevent sharing.

Sorry, but something remains not clear for me. In your previous message,
you said that

> These structs are therefore conceptually 'owned' by the Racket layer, so 
> where the librdf documentation notes that a returned object is shared, I make 
> a copy of it using one of the librdf copy-create functions. 

That is: 
- when you retrieve an already existing object (with a foo_get... function for
  example), you make a copy and make the gc call the free function on this
  copy when the value is no more reachabe,
- when you create an object, you don't make a copy, but you just embed it
  in a racket value.

Is this correct ?
Is so, that's the way I began to before being afraid of freeing objects
still in use. I wasn't aware of the counter already used internally.
 
> The problem I mentioned in the other message came about because one of these 
> librdf copy operations was accidentally a shallow copy rather than a deep 
> one, and if I recall correctly may have been only a documentation bug.

This I understand.

Thanks again,

Maxence

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

Reply via email to