title: RcppArmadillo: Issue with memory usage
body: <p>I have started using Rcpp. I like it a lot. I am fairly new to programming. I have a question regarding memory usage. Below is a reproducible problem:</p>
  
  <pre><code>library(RcppArmadillo)
  library(inline)
  code &lt;- "
    Rcpp::NumericVector input_(input);
    arma::cube disturb(input_.begin(), 2, 2, 50000000, false);
    return wrap(2);
  "
  Test &lt;- cxxfunction(signature(input = "numeric"), plugin = "RcppArmadillo", body = code)
  input &lt;- array(rnorm(2 * 2 * 50000000), dim = c(2, 2, 50000000))
  Test(input)
  </code></pre>
  
  <p>My understanding is that in the problem above the only memory usage is when I assign an array to the variable <strong>input</strong> in R. So I should only be using around 1.6 gb (2*2*50*8 = 1600). When I go to Rcpp, I initialise the variable <strong>input_</strong> using SEXP object which is a pointer. So this should not use any additional memory. Then when I initialise the variable <strong>disturb</strong>, I also use a pointer and set copy_aux = FALSE. So I should not be using any memory. So if my understanding is correct, I should only be using 1.6 gb when I run the code. Is this correct?</p>
  
  <p>However, when I run the code, the memory usage (judging by looking at System Monitor in Ubuntu) jumps above 10 gb (from around 1 gb) before falling back down to around 4 gb. I don't understand what is going on. Did I use Rcpp incorrectly?</p>
  
  <p>Your help is appreciated. Many thanks.</p>