After answering about tracemem
recently, I learned about retracemem
. The help for ?retracemem
and the example therein leave me unenlightened.
What does retracemem
actually do and why? It doesn't do what I thought it would do, i.e. point one object to the memory location of another, at least as far as I can tell.
I tried a wizardly invocation like .Internal(inspect())
, which performs no magic for me:
> a = 1:10
> b = a[-1]
> .Internal(inspect(a))
@00000000087AE578 13 INTSXP g0c4 [NAM(2)] (len=10, tl=23336) 1,2,3,4,5,...
> .Internal(inspect(b))
@00000000087AE8E8 13 INTSXP g0c4 [NAM(2)] (len=9, tl=7208) 2,3,4,5,6,...
> retracemem(b,retracemem(a))
> .Internal(inspect(b))
@00000000087AE8E8 13 INTSXP g0c4 [NAM(2)] (len=9, tl=7208) 2,3,4,5,6,...