0

I'm a noob in Rcpp programming and here is a simple question for Rcpp. Will it double the memory cost when using 'as' function in Rcpp? Take the following rough codes for an example, 'x' is a very big matrix. I am wondering if 'xx' and 'x' share the same memory or just copy a new memory from 'x'?

void test(SEXP x){
    arma::mat xx = as<arma::mat>(x);
}
YinLL
  • 287
  • 1
  • 3
  • 5
  • 1
    "It shouldn't". But you don't have to take my word for it. You can profile that (if you have memory profiling enabled) and/or benchmark. See the `examples/` directory of your RcppArmadillo installation. – Dirk Eddelbuettel Oct 31 '19 at 10:42
  • Dear Dirk, thanks a lot. – YinLL Nov 01 '19 at 13:08

0 Answers0