On 18.05.2011, at 15:17, Douglas Bates wrote: > On May 18, 2011 2:53 AM, <soeren.vo...@uzh.ch> wrote: > >> [...] >> >> When librarying the class, assigning an object, do some calculations, >> whatever -- everything goes fine. Yet, when using R CMD BATCH on a file >> listing the same commands as by hand, R produces some nice information at >> the end, however, here it produces an segmentation fault, which does -- >> according to my small knowledge -- say something bad: >> >> proc.time() >> user system elapsed >> 0.702 0.017 0.714 >> R(72992) malloc: *** error for object 0x2c9b604: incorrect checksum for >> freed object - object was probably modified after being freed. >> *** set a breakpoint in malloc_error_break to debug >> >> *** caught segfault *** >> address 0x4909d58, cause 'memory not mapped' >> >> Traceback: >> 1: save(list = ls(envir = .GlobalEnv, all.names = TRUE), file = outfile, >> version = version, ascii = ascii, compress = compress, envir = >> .GlobalEnv, precheck = FALSE) >> 2: save.image(name) >> 3: sys.save.image(".RData") >> aborting ... >> >> Any idea what goes wrong there? > > 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.
Hello Douglas Ah, I see. Thanks for this tip. However, I am wondering why removing objects and detaching the package (where the Rcpp module resides) do not resolve the issue in the same way: x <- new(FOO) do_something_with_x() rm(x) detach("package:GUTS") Regards *S* _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel