[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 06:14:47 CEST 2011


> i)   Without reproducible code, there is very little we can say here.
Here is mycode, I have "learningMatrix.h" and "learningMatrix.cpp":
///Header file:

#ifndef _mypac_LEARNING_MATRIX_H
#define _mypac_LEARNING_MATRIX_H

#include <RcppArmadillo.h>

RcppExport SEXP fastLm(SEXP ys, SEXP Xs) ;

#endif


///Source file:

#include "learningMatrix.h"

SEXP fastLm(SEXP ys, SEXP Xs) {

    return R_NilValue;
}


> ii)  See the 'Writing R Extensions' manual and the hints about valgrid, if you
>     really suspect leakage valgrind normally finds it.

I'll take a look at valgrind now.

Thanks,

Slava

On Fri, Oct 28, 2011 at 2:55 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 28 October 2011 at 14:34, Slava Razbash wrote:
> | 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?
>
> Doubtful.
>
> Compilers and linker don't normally include code that is not executed.
>
> | 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().
>

>
> ii)  See the 'Writing R Extensions' manual and the hints about valgrid, if you
>     really suspect leakage valgrind normally finds it.
>
> 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