[Rcpp-devel] [RcppParallel] Segfault but only on TravisCI

Dirk Eddelbuettel edd at debian.org
Sat Jan 20 16:22:19 CET 2018

On 20 January 2018 at 15:05, Alexis Sarda wrote:
| The idea is indeed to avoid copying memory. I thought that doing something
| like the following would allow me to read the values created in R from
| within the threads:
| Rcpp::NumericVector vec(vector_from_R);
| std::vector<RcppParallel::RVector<double>> series;
| series.push_back(RcppParallel::RVector<double>(vec));
| // then in the threads:
| double val = series[index_for_this_thread][0];
| The data created on the R side is never modified by these functions, just
| read. It is possible for different threads to read the same memory, but I
| thought reading was not subject to race conditions.
| The segfaults are very consistent, every OSX build fails with the same
| error at the same point. The fact that it happens with clang++ but not with
| gcc++ is puzzling to me.
| The Rcpp::List may contain a lot of NumericVector or NumetricMatrix series,
| so I would rather not copy all of them.

But the RcppParallel documentation is pretty clear on "do not touch R memory
from multiple threads".


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list