[R] R_alloc vs. malloc

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 11 13:35:34 CEST 2008


On Fri, 11 Apr 2008, Søren Højsgaard wrote:

> Dear list
> I have two (trivial) memory-questions related to a call with .C:

On Windows, I presume from past questions from yourself.  The answers 
really are completely Windows-specific, so please do remember to tell us 
your OS!

> If I allocate memory with R_alloc in a C-program (called with .C), will 
> that memory "be taken from" the "available memory pool" (of a maximum of 
> 4gb?) which R can allocate? (This is the impression I get from "Writing 
> R extensions".)

Yes.  Same for Calloc.

> If instead I use malloc; will that memory then be taken from the 
> available pool for R? Or does that happen without having an impact on 
> R's "available memory pool"?

>From a different pool, but from the same address space.  There is no more 
virtual memory that R does not have access too, so you would just be 
setting up in competition.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list