[Rcpp-devel] [RcppParallel] Segfault but only on TravisCI
edd at debian.org
Sat Jan 20 14:46:46 CET 2018
On 20 January 2018 at 12:45, Alexis Sarda wrote:
| I've found out that the problem remains on OSX builds, and apparently it is
| caused by clang itself. I used R-hub's fedora-clang-devel to test:
| The error that stands out to me is:
| *** Error in `/opt/R-devel/lib64/R/bin/exec/R': corrupted
| double-linked list: 0x00000000099a3870 ***
| I am essentially doing a parallel distance matrix calculation as shown in
| the Rcpp gallery, but I have several distance functions. All the classes
| that provide distance calculations have a member wrapping std::vector of
| either RcppParallel's RVector<double>, RMatrix<double>, or Armadillo's
| cx_vec. Here's the template I'm using to wrap those members:
| Could the corruption be caused by this?
It looks to me like you are just moving _actual Rcpp vectors_ around from the
Rcpp::List into your container, and then access them using your operator
types. But ... that still accesses R memory through these vectors, and with
that we may get a (rare ?) race condition on stack unwinding etc.
The truly paranoid approach would be to actually make truly distinct types
and copy (ie memcpy). That file is short, so maybe you can try it.
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel