From tlumley at uw.edu  Tue Jan 17 22:50:38 2012
From: tlumley at uw.edu (Thomas Lumley)
Date: Wed, 18 Jan 2012 10:50:38 +1300
Subject: [Rd] names<- appears to copy 3 times?
In-Reply-To: <1326787919.14043.113.camel@netbook>
References: <1326787919.14043.113.camel@netbook>
Message-ID: <CAJ55+dKJ_av9Gac1dA1J_AksrJBpnHcdaB9Qdj=soExWFpBafA@mail.gmail.com>

On Tue, Jan 17, 2012 at 9:11 PM, Matthew Dowle <mdowle at mdowle.plus.com> wrote:
> Hi,
>
> $ R --vanilla
> R version 2.14.1 (2011-12-22)
> Platform: i686-pc-linux-gnu (32-bit)
>> DF = data.frame(a=1:3,b=4:6)
>> DF
> ?a b
> 1 1 4
> 2 2 5
> 3 3 6
>> tracemem(DF)
> [1] "<0x8898098>"
>> names(DF)[2]="B"
> tracemem[0x8898098 -> 0x8763e18]:
> tracemem[0x8763e18 -> 0x8766be8]:
> tracemem[0x8766be8 -> 0x8766b68]:
>> DF
> ?a B
> 1 1 4
> 2 2 5
> 3 3 6
>>
>
> Are those 3 copies really taking place?
>

tracemem() isn't likely to give false positives.  Since you're on
Linux, you could check by running under gdb and setting a breakpoint
on memtrace_report, which is the function that prints the message.
That would show where the duplicates are happening.

  - thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland



[Rd] names<- appears to copy 3 times?
Thomas Lumley