Rcpp devs,<div>I came across what might be a bug. There are residuals that are not cleaned up when a constructor throws an error. Consider the following.</div><div><br></div><div>cpp file----------------------</div>
<div>#include <Rcpp.h></div><div><div>#include <exception></div></div><div><div><div>class testError{</div><div> public:</div><div> testError(){ throw std::runtime_error("You shall not create ME!");}</div>
<div>};</div></div></div><div>RCPP_MODULE(yada){</div><div> class_<testError>("testError").constructor();</div><div>}</div><div>---------------------------------</div><div>Everything else is standard from the module example.</div>
<div><br></div><div>in R session:</div><div>R> library(errtest)</div><div><div>Loading required package: Rcpp</div></div><div><div>R> x<-new(testError)</div><div>Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) : </div>
<div> You shall not create ME!</div><div>R> x</div><div>Error: object 'x' not found</div><div>R> gc()</div><div>Error in x$.self$finalize() : object '.pointer' not found</div><div> used (Mb) gc trigger (Mb) max used (Mb)</div>
<div>Ncells 260744 14.0 467875 25 350000 18.7</div><div>Vcells 185640 1.5 786432 6 552118 4.3</div></div><div>----------</div><div><br></div><div>The things that makes me wonder is the x$.self$finalize() Error, as there should be nothing to delete.</div>
<div><br></div><div>Thanks,</div><div>Andrew</div><div><br></div>