Rcpp devs,
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.

cpp file----------------------
#include <Rcpp.h>
#include <exception>
class testError{
  public:
    testError(){ throw std::runtime_error("You shall not create ME!");}
};
RCPP_MODULE(yada){
  class_<testError>("testError").constructor();
}
---------------------------------
Everything else is standard from the module example.

in R session:
R> library(errtest)
Loading required package: Rcpp
R> x<-new(testError)
Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) :
  You shall not create ME!
R> x
Error: object 'x' not found
R> gc()
Error in x$.self$finalize() : object '.pointer' not found
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 260744 14.0     467875   25   350000 18.7
Vcells 185640  1.5     786432    6   552118  4.3
----------

The things that makes me wonder is the x$.self$finalize() Error, as there
should be nothing to delete.

Thanks,
Andrew
_______________________________________________
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