[Rcpp-devel] RcppArmadillo Memory Leak?
Alessandro Vitale
alevitale at gmail.com
Mon Nov 18 12:41:58 CET 2013
Hi,
I was trying RcppArmadillo sparse matrix and found an odd memory behavior.
I used this code from Romain http://stackoverflow.com/questions/18336021/sparse-matrix-conversion-from-matrix-to-armadillo-with-rcpparmadilloextensions-s
and added the first line to manage large matrices
#define ARMA_64BIT_WORD
#include <RcppArmadillo.h>
// [[Rcpp::depends("RcppArmadillo")]]
using namespace Rcpp ;
// [[Rcpp::export]]
arma::sp_mat sparse( arma::sp_mat A ){
A(0,0) = 1;
A(1,0) = 2;
return A ;
}
then tested with this
library(Matrix)
testMatrix <- Matrix(data=0,nrow=1e7,ncol=1e7,sparse=TRUE) # 40MB sparse matrix
gc()
sparse(testMatrix)
gc()
After every call, the memory from gc() is stable, while rsession process memory keeps growing of around 100Mb at each call and doesn't decrease after the garbage collection.
Am I doing something wrong?
For reference, I'm using Rcpp_0.10.6, RcppArmadillo_0.3.920.1, R 3.0.1 on a Mac OSX 10.7.5.
Thanks for the help!
Alessandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131118/0cedabca/attachment.html>
More information about the Rcpp-devel
mailing list