[Rcpp-devel] Pointer troubles
On 3 August 2011 at 15:44, Willem Ligtenberg wrote:
| Hi Dirk, | | Won't test be cleared up when the garbage collector calls | intObjFinalizer(PointerTotest)? That is what I thought the finalizer | would do. | Is there a specific chapter about the mixing of new/delete and the R | allocations? It may have been in Section 6.1 about 'Memory allocation' but I don't see it right now. I may have misremembered the recommendation about new/delete with the one for malloc/free: most of the time you are better off using the R facilities as you fall back onto R's error handling. And in general, you should not need new / delete. Modern C++ uses STL containers which hide all this, and Rcpp conveniently wraps that for you -- just like Romain just showed you the simpler XPtr use. Dirk
Gauss once played himself in a zero-sum game and won $50.
-- #11 at http://www.gaussfacts.com