Re: [Rd] R_PreserveObject, R_ReleaseObject : reference counting needed ?

From: Laurent Gautier <>
Date: Sat, 02 Jan 2010 19:02:54 +0100

On 1/2/10 5:50 PM, Romain Francois wrote:
> Thanks.
> On 01/02/2010 05:36 PM, Laurent Gautier wrote:
>> [Disclaimer: what is below reflects my understanding from reading the R
>> source, others will correct where deemed necessary]
>> On 1/2/10 12:00 PM, wrote:


>>> In particular, if we preserve the same SEXP twice (or more), should we
>>> implement some sort of reference counting ?
>> This depends on the requirements for your system.
> We wrap up SEXP into a C++ class that in particular manages itself
> preserving and releasing the object to garbage collection.

If you do not allow several C++ instances to share the same SEXP, you should not need reference counting. In the case of rpy2, this was made necessary for allowing inheritance (as nested calls to constructors can cause a transient sharing of the given SEXP across several Python objects).


L. mailing list Received on Sat 02 Jan 2010 - 18:07:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 02 Jan 2010 - 20:00:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive