From lgautier at gmail.com  Sat Jan  2 19:02:54 2010
From: lgautier at gmail.com (Laurent Gautier)
Date: Sat, 02 Jan 2010 19:02:54 +0100
Subject: [Rd] R_PreserveObject,
 R_ReleaseObject : reference counting needed ?
In-Reply-To: <4B3F7973.70203@dbmail.com>
References: <mailman.11.1262430004.8711.r-devel@r-project.org>
	<4B3F7625.1080806@gmail.com> <4B3F7973.70203@dbmail.com>
Message-ID: <4B3F8A4E.8060605@gmail.com>

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, r-devel-request at r-project.org 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.



[Rd] R_PreserveObject, R_ReleaseObject : reference counting needed ?
Laurent Gautier