From tlumley at u.washington.edu  Tue Jul 19 23:18:27 2005
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Tue, 19 Jul 2005 14:18:27 -0700 (PDT)
Subject: [Rd] R_AllocatePtr
In-Reply-To: <Pine.OSF.4.58.0507191522090.84377@odin.mdacc.tmc.edu>
References: <Pine.OSF.4.58.0507191522090.84377@odin.mdacc.tmc.edu>
Message-ID: <Pine.A41.4.61b.0507191416250.33352@homer06.u.washington.edu>

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



[Rd] R_AllocatePtr
Thomas Lumley