[Rcpp-devel] Have I noticed memory management bug in RcppArmadillo or is this the intended behaviour?
Slava Razbash
slava.razbash at gmail.com
Fri Oct 28 05:34:39 CEST 2011
Hello Dirk and Rcpp-devel list,
I commented out everything in the RcppArmadillo / fastLm() function
and add the line:
return R_NilValue;
I still get the same behaviour where gc() does not free as much memory
as for() { .Call() } caused it to use.
Could it be that I am just observing some component of RcppArmadillo
being loaded into memory?
I also tried in R:
for(i in 1:999999) { a <-list(w=matrix(c(1:14),1,14),
w.transpose=matrix(c(1:14), 14, 1) ) }
In this case, all of the extra memory used is freed with a call to gc().
Thanks,
Slava
On Thu, Oct 27, 2011 at 11:08 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 27 October 2011 at 20:17, Slava Razbash wrote:
> | What my function had in common with the fastLm functions is that both used:
> | return Rcpp::List::create( );
> | and both used arma::mat objects.
>
> Memory returned to R is freed when R decides to free it.
>
> To make your "tests" comparable, all (incl Rcpp, RcppArmadillo, R API and R
> function) have to create and return the same object --- test with identical()
> or at least all.equal(). Easiest to do by returning a single NULL (via
> R_NilValue) and nothing else.
>
> You returned larger objects from RcppArmadillo / fastLm() so maybe those hang
> around longer.
>
> Dirk
>
> --
> "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
> dark to read." -- Groucho Marx
>
More information about the Rcpp-devel
mailing list