[R-pkg-devel] debugging problems with valgrind

code M complexm at gmail.com
Tue Jun 23 13:25:24 CEST 2015

i am developing a little package that basically is a simple wrapper around
some C++ code, that is being called via the RCpp package. Basically the
code works, but i did find out that the results are different for 32bit and
64bit environments, so this might point to problems in the C++ code. The
32bit box is a virtual machine, the 64bit is running native. Both systems
are Ubuntu 15.04 with R 3.1.2. Also, when calling build_win() i get
different results than on my computer.

To debug the situation, i tried to use valgrind as a debugger on the 32bit
virtual machine. So instead of a simple  "R --vanilla <./demo.R" (the demo
calls only the corresponding unit test) i called now "R -d "valgrind"
--vanilla < demo.R". The (very funny) result is that when called with
valgrind, my tests are now running fine, i.e. i get the very same results
as on my 64bit box. So in some ways valgrind seems to change the behaviour
of R, luckily into a 'good' direction-- but which is nothing that i would
have expected. (To make sure, i also did the same two commands on my native
64bit system, there is no such change, i.e. valgrind does not change

I am not sure if i can make a minimal test script that reproduces the
behaviour. Before i try i would like to hear if anyone ever encountered
something similar with using valgrind and R, and maybe can point out if
this is something related to R, valgrind, Rcpp, C++ code or something
completely different (while i am certain that the C++ code is not really
64bit ready yet).

(In case anyone wants to peek into the code, it can be found at


	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list