<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>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.</p>
<p><br>
</p>
<p>Jouni<br>
</p>
<p><br>
</p>
<p><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>Lähettäjä:</b> Simon Barthelmé <simon.barthelme@gipsa-lab.fr><br>
<b>Lähetetty:</b> maanantai 4. syyskuuta 2017 13.14.52<br>
<b>Vastaanottaja:</b> Helske, Jouni; Rcpp-devel@lists.r-forge.r-project.org<br>
<b>Aihe:</b> Re: [Rcpp-devel] Rstudio crashes with repeated calls to sourceCpp with Xptr export</font>
<div> </div>
</div>
<div>Hi Helske<br>
<br>
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?
<br>
<br>
Simon<br>
<br>
<div class="moz-cite-prefix">On 04/09/2017 10:22, Helske, Jouni wrote:<br>
</div>
<blockquote cite="mid:5361c84cc698417bb7b0b56bd5342e51@jyu.fi" type="cite"><style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p><span id="ms-rterangepaste-start"></span></p>
<p>Hi,</p>
<p><br>
</p>
<p>In the bssm package (<a moz-do-not-send="true" href="https://github.com/helske/bssm" class="OWAAutoLink" id="LPlnk158659" previewremoved="true">https://github.com/helske/bssm</a>), 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?</p>
<p><br>
</p>
<p>Simplest case of this is the discretized SDE models, this is the function which user modifies:
<a moz-do-not-send="true" href="https://github.com/helske/bssm/blob/master/vignettes/sde_functions.cpp" class="OWAAutoLink" id="LPlnk922418" previewremoved="true">
https://github.com/helske/bssm/blob/master/vignettes/sde_functions.cpp,  </a>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).</p>
<br>
<p>Best,</p>
<p><br>
</p>
<p>Jouni Helske<br>
</p>
<span id="ms-rterangepaste-end"></span><br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre wrap="">_______________________________________________
Rcpp-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a>
<a class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a></pre>
</blockquote>
<br>
</div>
</div>
</body>
</html>