tracemem(x)
untracemem(x)
retracemem(x, previous = NULL)
NULL
.tracemem
or retracemem
.NULL
(invisibly).
tracemem
and untracemem
give errors when R is not
compiled with memory profiling; retracemem
does not (so it can be
left in code during development).It is enabled in the CRAN OS X and Windows builds of R.
When an object is traced any copying of the object by the C function
duplicate
produces a message to standard output, as does type
coercion and copying when passing arguments to .C
or
.Fortran
.
The message consists of the string tracemem
, the identifying
strings for the object being copied and the new object being created,
and a stack trace showing where the duplication occurred.
retracemem()
is used to indicate that a variable should be
considered a copy of a previous variable (e.g., after subscripting).
The messages can be turned off with tracingState
.
It is not possible to trace functions, as this would conflict with
trace
and it is not useful to trace NULL
,
environments, promises, weak references, or external pointer objects, as
these are not duplicated.
These functions are primitive.
capabilities("profmem")
to see if this was enabled for
this build of R.