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

Vladimir Dergachev vdergachev at rcgardis.com
Thu Feb 1 20:15:48 CET 2007


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



More information about the R-devel mailing list