[Rcpp-devel] rsession memory consumption blows up

Fabio Tordini tordini at di.unito.it
Tue Jun 23 18:45:55 CEST 2015


Hello,

I encountered this problem while working on my Rcpp package. I don't 
know if it can be related to Rcpp, but I post it here looking for some 
advices. I'll try to make myself as clear as possible:

from an R function in my Rcpp package I call a C++ function where huge 
datasets (~ 2GB) are loaded in memory, parsed and used for computation. 
Clearly, every object and every data structure is handled on the C++ 
side. The computation advances successfully and produces a graph that is 
returned to R in terms of an edges list.
On the R side I can use this list in many ways, but first it gets 
converted into a data.table, whose size is about 2MB. What is surprising 
is that the 'rsession' process keeps holding 3.2 GB of physical memory, 
as it can be easily checked with the 'top' command from shell.
When I decide to run again the R function above, the rsession crashes 
soon afterwards, and this is likely due to a memory overflow (despite my 
PC has 8GB RAM).

it seems like the C++ function, once it terminates its execution, does 
not free the memory used. instead, rsession keeps holding these objects 
even though C++ has terminated. is it possible?


Thanks in advance,
Fabio


More information about the Rcpp-devel mailing list