[Rcpp-devel] Errors in constructors
Andrew Redd
amredd at gmail.com
Tue Jun 28 20:47:21 CEST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110628/30413a34/attachment.htm>
More information about the Rcpp-devel
mailing list