Hi,

I already tried valgrind, that doesn't give any hints. So far I haven't been 
able to reproduce this in R console, but could be just bad(?) luck as the whole 
crash happens so randomly. I am now running sourceCpp with rebuild = TRUE and 
subsequent function calls on a loop, and it takes seemingly random amount of 
iterations until Rstudio crashes.


Jouni



________________________________
Lähettäjä: Simon Barthelmé <simon.barthe...@gipsa-lab.fr>
Lähetetty: maanantai 4. syyskuuta 2017 13.14.52
Vastaanottaja: Helske, Jouni; Rcpp-devel@lists.r-forge.r-project.org
Aihe: Re: [Rcpp-devel] Rstudio crashes with repeated calls to sourceCpp with 
Xptr export

Hi Helske

I've had this happen to me and if memory serves in my case it was due to a 
memory leak on the C++ side that didn't bother R too much but caused sourceCpp 
to crash. Maybe try valgrind?

Simon

On 04/09/2017 10:22, Helske, Jouni wrote:

Hi,


In the bssm package (https://github.com/helske/bssm), I let the users define a 
state space model via own C++ functions which are then exported as Xptr to R 
side, and passed back to C++ function for SMC/MCMC etc. Normally this works 
fine, but when user repeatedly modifies the model functions and re-exports them 
via repeated calls sourceCpp, sometimes whole Rstudio crashes. I haven't been 
able to pinpoint the reason or minimal example. Have anyone else experienced 
similar issues or is it just me i.e. error in my own implementations?


Simplest case of this is the discretized SDE models, this is the function which 
user modifies: 
https://github.com/helske/bssm/blob/master/vignettes/sde_functions.cpp,  
<https://github.com/helske/bssm/blob/master/vignettes/sde_functions.cpp> and 
the relevant parts of the package codes are in src/function_pointers.h, 
src/sde_ssm.cpp and src/R_sde.cpp (I don't really expect anyone to read through 
all of these).


Best,


Jouni Helske




_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org<mailto:Rcpp-devel@lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to