Antoine,
I think there are few things going on here. One is that actual _R_ objects may only get destroyed when gc() gets called. Which we applications writer do not control. Another thing that may have an effect is the use of .C() which we all more or less moved away from. Anyway, if we make your example a proper C++ one with proper C++ scope (by trivial Rcpp wrapping for ease, but that should not be a requirement) we see the four message you desire: #### Code #include <Rcpp/Lightest> static int count = 0; class A { public: A(){ printf("c %d\n", count); count++; } ~A(){count--; printf("d %d\n", count); } }; // [[Rcpp::export]] void testAL(){ A a; { A b; } Rcpp::stop("does not write [d 0]"); } /*** R testAL() */ #### Output > Rcpp::sourceCpp("/tmp/ctorDemo.cpp") > testAL() c 0 c 1 d 1 d 0 Error in eval(ei, envir) : does not write [d 0] > Hope this helps, Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel