From vdergachev at rcgardis.com  Thu Feb  1 20:15:48 2007
From: vdergachev at rcgardis.com (Vladimir Dergachev)
Date: Thu, 1 Feb 2007 14:15:48 -0500
Subject: [Rd] SEXP i/o, .Call(), and garbage collection.
In-Reply-To: <45C238F2.8070900@cimr.cam.ac.uk>
References: <38c08c270702011022k2b15e80fl1cac5eef32eeb882@mail.gmail.com>
	<45C238F2.8070900@cimr.cam.ac.uk>
Message-ID: <200702011415.48587.vdergachev@rcgardis.com>

On Thursday 01 February 2007 2:01 pm, Hin-Tak Leung wrote:
> One possible reason for such problems is if you copy the pointers
> for say, attributes, classes, names, rather than duplicating them.
> With very few exceptions, mostly in classes, no two R objects of
> the sort you normally encounter/create/play-with should share *any*
> part of their data-structure. e.g. such problem can result if you
> assign the row names of the input to the output (even if both have
> the same row names).
>

Hmm.. I thought that using setAttrib() would automatically increase the 
reference count, right ?

In particular, I quite often use "pseudo-factor" string vectors - where the 
string objects are passed through cache and reused when forming a string 
vector. The result is true character() type but with considerable memory 
savings. The downside is that R reference count field is usually saturated.

                                best

                                    Vladimir Dergachev



[Rd] SEXP i/o, .Call(), and garbage collection.
Vladimir Dergachev