[Rd] R_AllocatePtr

Thomas Lumley tlumley at u.washington.edu
Tue Jul 19 23:18:27 CEST 2005


On Tue, 19 Jul 2005, Paul Roebuck wrote:

> Had been looking into Luke Tierney's R_AllocatePtr() and
> was left with a question about exactly when does R reclaim
> heap memory. Implication of 'simpleref.nw' is that one can
> allocate C data on the R heap, and as long as pointer object
> is alive, the data and pointer will remain valid. But it
> calls allocString() which is implemented using R_alloc().

Um, no.  allocString is
SEXP allocString(int length)
{
     return allocVector(CHARSXP, length);
}

In fact the reverse is true, R_alloc is implemented using allocString.

 	-thomas


Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle



More information about the R-devel mailing list