Remove input R object in C++ function environment -
i have rcpp function inside r function. r function produces object (say large list) , feeds rcpp function. inside rcpp function, copy r object's data number of c++ classes, , on r object practically useless. want release memory r object (or maybe mark garbage if deleting hard?). the idea is: // [[rcpp::export]] void cppfun(list structureddata) { // copy structureddata c++ classes // want structureddata gone save memory // main algorithms ... } /***r rfun(input) { # r creates structureddata input cppfun(structureddata) } */ i tried calling r's "rm()" in c++ can identify object names in r's global environment. example: // [[rcpp::export]] void cppfun() { language("rm", "globaldat").eval(); language("gc").eval(); } /***r globaldat = 1:10 ls() # shows "globaldat" created. cppfun() # shows "globaldat" no longer in environment. ls() */ however, following not work: // [[rcpp::export]] void...