I have a script that runs a bunch of simulations in parallel, using doMC and plyr's '.parallel=TRUE', combining the results into a data.frame for further analysis. Each simulation calls into a package where the majority of calculation is written in C++ with Rcpp and RcppArmadillo.

If I run the simulation at large enough scale, I often get segfaults and other memory-related crashes, such as:

R(75101) malloc: *** error for object 0x105d06400: incorrect checksum for freed object - object was probably modified after being freed.

I'm at a loss how to debug this. I tried running with 'gdb', but don't know how to make it monitor all the processes spawned by 'doMC', and running all simulations sequentially does not trigger any invalid memory accesses. Similarly with valgrind: I see some still reachable (leaked?) blocks (all coming from R core), but no invalid accesses when running sequentially.

Any suggestions on what to do? This is on OS X 10.9, R 3.0.2, and up-to-date CRAN version of doMC (1.3.2).

Thank you,

Davor
	[[alternative HTML version deleted]]

