[Rd] Change of variable address due to GC

lille stor lille.stor at gmx.com
Fri Sep 8 16:08:01 CEST 2017


Hi,
 
I would like to know if the Garbage Collector (GC) changes the address of a variable in R. In other words, assuming the following code:
 
      library(pryr)
 
      x <- 1:1024
 
      addr <- address(x)  # save address of variable "x" in "addr"

              .
              .
              .
      (execution of operations that create/destroy many small/big objects in memory, which will likely make the GC to be called)
              .
              .
              .
 
      if (addr != address(x))
      {
          print("Address of x changed!")
      }
 
 
Will the message "Address of x changed!" be ever printed?
 
Thank you!



More information about the R-devel mailing list