I’m not that familiar with R’s garbage collection, but maybe you can call 
something manually to free up memory?

> rewrite your program to work more incrementally and releasing memory as 
> needed.

Or the simple alternative solution is to free everything but the objects to be 
returned in the function itself.

Best,
--
Hao Ye
h...@ucsd.edu

> On Jun 23, 2015, at 9:57 AM, Dirk Eddelbuettel <e...@debian.org> wrote:
> 
> 
> On 23 June 2015 at 18:45, Fabio Tordini wrote:
> | 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?
> 
> Of course.  We all have bad days every now and then.  :)
> 
> From your description you seem to be holding on to data for too long, and
> maybe even transfering back to R, when it crashes.  "So don't do that." You
> identified a run-time constraint.  Now you either need a bigger machine
> (100gb of ram in not unheard of these days) or rewrite your program to work
> work more incrementally and releasing memory as needed.
> 
> Dirk
> 
> -- 
> http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel@lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to