Re: [Rd] memory allocation if multiple names point to the same object

2014-06-03 Thread Dénes Tóth
Dear Michael, thank you for the enlightenment. Just for the records, here is the solution that Michael referred to: http://developer.r-project.org/Refcnt.html Best, Denes On 06/03/2014 03:57 PM, Michael Lawrence wrote: This is because R keeps track of the names of an object, until there

Re: [Rd] memory allocation if multiple names point to the same object

2014-06-03 Thread Michael Lawrence
This is because R keeps track of the names of an object, until there are 2 names. Thus, once it reaches 2, it can no longer decrement the named count. In this example, 'a' reaches 2 names ('a' and 'b'), thus R does not know that 'a' only has one name at the end. Luke has added reference counting t

[Rd] memory allocation if multiple names point to the same object

2014-06-02 Thread Dénes Tóth
Hi, Please consider the following code: a <- seq.int(10) # create a tracemem(a) a[1:4] <- 4:1 # no internal copy b <- a # no internal copy b[1:4] <- 1:4 # copy, b is not a any more a[1:4] <- 1:4 # copy, but why? With results: > a <- seq.int(10) > tracemem(a) [1] "<0x1792bc0>" >