[Rcpp-devel] Segfault error during simulation in Rcpp

Dirk Eddelbuettel edd at debian.org
Mon May 6 20:39:33 CEST 2013


On 6 May 2013 at 19:03, Matteo Fasiolo wrote:
| Sorry for the silly question, but since I'm using sourceCpp() too I should't
| call 
| getRNGstate/putRNGstate, right?

If you use any of the random number generators provided by R via Rcpp, then
you __MUST__ also instantiate an RNGScope() object (which does this for you).

We documented this *very* clearly in a number of places in the documentation.

(And yes, sourceCpp() adds one as a courtesy but you should still add
one. The extra few nanoseconds in execution speed won't matter.)

You report is otherwise still unreproducible at my end.   

Your program is also complex in that it does a few things.  Try writing
smaller and smaller programs still exhibiting the error at your end.  And do
report back if you find something, or have questions.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list