[Rcpp-devel] Avoiding memory allocations when using Armadillo, BLAS, and LAPACK
edd at debian.org
Wed Feb 18 17:00:28 CET 2015
It is a little challenging to keep up with your ability to ask this question
here, on StackOverflow and again on r-devel. As I first saw it here, I'll
R is a dynamically-typed interpreted language with many bells and whistles,
but also opaque memory management. My recommendation always is to "if in
doubt and when working with large objects" to maybe just step aside and do
something different outside of R.
You mentioned logistic regression. And we did something similar at work: use
Rcpp as well as bigmemory via external pointers (ie Rcpp::XPtr) so that *you*
can allocate one chunk of memory *you* control, and keep at arm's length of
R. Implementing a simple glm-alike wrapper over that to fit a logistic
regression in then not so hard. We even did it in a multicore context to get
extra parallelism still using only that one (large!!) chunk of memory.
There are several articles in the Rcpp Gallery that should get you started.
Hope this helps, Dirk
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel