[Rcpp-devel] Garbage collection PreserveObject.

Guillaume Yziquel guillaume.yziquel at citycable.ch
Sun Jan 24 00:44:13 CET 2010


Hi.

I recently noticed that the garbage-collection interfacing toping has 
been quite active at the beginning of the month on this list, so I'm 
asking here. My question concerns essentially my OCaml binding, but I'll 
try to make it as language agnostic as possible to somehow stay within 
the scope of this list.

Two questions:

-1- From what I gathered, it is fine to issue two PreserveObject 
statements on the same SEXP, and then two ReleaseObject afterwards. It 
seemed to me that reference counting was not needed, from my 
understanding of the past discussion. Am I wrong?

-2- Once you have, in your C/C++ code, obtained a pointer to a SEXP from 
R, do you need to PROTECT it, then do a PreserveObject, then UNPROTECT 
it? Or is PreserveObject simply fine? (I guess so, but I'm damn unsure).

All the best,

-- 
      Guillaume Yziquel
http://yziquel.homelinux.org/


More information about the Rcpp-devel mailing list