[Rcpp-devel] R CMD BATCH - segfault (was: Create and access several instances of a C++ class from R)

soeren.vogel at uzh.ch soeren.vogel at uzh.ch
Sun May 22 12:55:27 CEST 2011

On 20.05.2011, at 17:26, Douglas Bates wrote:

On Fri, May 20, 2011 at 5:01 AM,  <soeren.vogel at uzh.ch> wrote:

> On 18.05.2011, at 15:17, Douglas Bates wrote:
>> As you can see, the problem occurs when R is saving the worksheet.  At
>> present an instance of a Rcpp module class cannot be saved. It is likely
>> that this will need to be addressed by the person designing each C++ class
>> that will be expressed in a module.  R can't serialize the contents of
>> memory that it doesn't "own".
>> The current fix is "don't do that".  Add the --no-save or --vanilla in your
>> call to R CMD BATCH to suppress saving the worksheet.


Just to get that clearly: Whatever I do with a C++ class in one session will be lost after quit? So, that would mean, to save my current work (done with an Rcpp module class) requires me to write a representation of the c++ object in R, which can be saved and which, after reload, rebuilds the last state of R affairs? Guessing that, my conclusion would be to not expose the Rcpp module class, rather to build an R class which rests upon the C++ stuff and holds the important information. That in turn would mean almost double use of memory? Or how would you recommend to work around?

Sören + Carlo

More information about the Rcpp-devel mailing list