[Rcpp-devel] Rcpp & multicore: segfault due to unmapped memory

Stefano Calza stecalza at gmail.com
Fri Dec 9 16:12:18 CET 2011


Hi everybody


I built my very first package using Rcpp for doing some intense computing on sequencing data.

Now it works fine if I run it sequentially. But I want to take advantage of multicore platform so I'm using "parallel".

And here I have a very unpredictable behaviour. Every now and then I get segfault due to unmapped memory. And only on parallel execution, never serial.

I have several functions, but I is the wrapper called by mclapply. Here all SEXP arguments are then turned to Rcpp objects using clone(). Afaik they are deep copied.

Looks like the different spawned process sometimes try to work on the same memory slot. But how can it be?
Also the behaviour is really unpredictable. Sometimes it happens, sometimes it doesn't. Using mc.preschedule=TRUE all runs should be reproducible, but this is not the case.

I never had any trouble in using code written with "the standard" .C interface using multicore & Co.

So do anybody has any hint on where can I look for this bug?

Thanks

Stefano


More information about the Rcpp-devel mailing list