tracemem(base)
tracemem()所属R语言包:base
Trace Copying of Objects
跟踪对象的复制
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function marks an object so that a message is printed whenever the internal function duplicate is called. This happens when two objects share the same memory and one of them is modified. It is a major cause of hard-to-predict memory use in R.
此功能标志着印这样一条消息的内部功能duplicate时被称为对象。这两个对象共享相同的内存,其中一人被修改。这是一个重要原因硬预测R中的内存使用
用法----------Usage----------
tracemem(x)
untracemem(x)
retracemem(x, previous = NULL)
参数----------Arguments----------
参数:x
An R object, not a function or environment or NULL.
一个R对象,不是一个函数或环境或NULL。
参数:previous
A value as returned by tracemem or retracemem.
A值返回tracemem或retracemem的。
Details
详情----------Details----------
This functionality is optional, determined at compilation, because it makes R run a little more slowly even when no objects are being traced. 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).
此功能是可选的,在编译时确定的,因为它使ř运行多一点缓慢甚至当没有对象正在追查。 tracemem和untracemem给当R是不是与内存分析编译错误; retracemem不(因此它可以留在发展过程中的代码)。
When an object is traced any copying of the object by the C function duplicate or by arithmetic or mathematical operations produces a message to standard output. 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).
当一个对象被追查由C函数duplicate或复制对象的任何算术或数学运算,产生一个标准输出的消息。该消息由字符串tracemem,该对象的标识字符串被复制,并正在创建新的对象,和堆栈跟踪显示重复发生。 retracemem()是用来表示一个变量应被视为以前的变量的副本(如后标)。
The messages can be turned off with tracingState.
消息可以被关闭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.
这是不可能追查,因为这与trace将冲突的职能,并追查NULL,环境,承诺,弱引用或外部指针的对象,因为这些都是不重复,它是没有用处的。
These functions are primitive.
这些功能是原始的。
值----------Value----------
A character string for identifying the object in the trace output (an address in hex enclosed in angle brackets), or NULL (invisibly).
一个字符串对象确定在跟踪输出(十六进制的地址,在尖括号中),或NULL(不可见)。
参见----------See Also----------
trace, Rprofmem
trace,Rprofmem
http://developer.r-project.org/memory-profiling.html
举例----------Examples----------
a <- 1:10
tracemem(a)
## b and a share memory[#B和共享内存]
b <- a
b[1] <- 1
untracemem(a)
## copying in lm[#复制在LM]
d <- stats::rnorm(10)
tracemem(d)
lm(d ~ a+log(b))
## f is not a copy and is not traced[#f是不是副本,是不会追查]
f <- d[-1]
f+1
## indicate that f should be traced as a copy of d[#表明,F应该追溯到d的副本]
retracemem(f, retracemem(d))
f+1
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|