【发布时间】:2014-02-04 02:56:20
【问题描述】:
我正在尝试测试当前 R 版本的内存限制是什么。
runtest <- function(size) {
x <- "testme"
while(0<1) {
x <- c(x, x)
size <<- object.size(x) # size of x when fail
}
}
通过在笔记本电脑的控制台中运行runtest(size),我收到以下错误:
> runtest(size)
Error: cannot allocate vector of size 4.0 Gb
In addition: Warning messages:
1: In structure(.Call(C_objectSize, x), class = "object_size") :
Reached total allocation of 7915Mb: see help(memory.size)
2: In structure(.Call(C_objectSize, x), class = "object_size") :
Reached total allocation of 7915Mb: see help(memory.size)
3: In structure(.Call(C_objectSize, x), class = "object_size") :
Reached total allocation of 7915Mb: see help(memory.size)
4: In structure(.Call(C_objectSize, x), class = "object_size") :
Reached total allocation of 7915Mb: see help(memory.size)
> size
2147483736 bytes
>
这个尺寸看起来非常接近人们之前提到的 2^31-1 限制。因此,我尝试在我们升级后的具有 128GB RAM 的桌面上运行相同的代码,并将 64 位版本的快捷方式中的变量设置为 100GB 的最大内存使用量。这是我得到的新错误:
Error in structure(.Call(C_objectSize, ), class = "object_size"):
long vectors not supported yet: unique.c: 1720
> size
8589934680 bytes
>
这个 8.5GB 的限制是否与在 Windows O/S(特别是 Windows 7 企业版)中运行有关?我认为 R 帮助文件 (http://stat.ethz.ch/R-manual/R-devel/library/base/html/Memory-limits.html) 解释了这一点,但我无法理解它在说什么(不是我的专业领域)。
【问题讨论】:
-
我不太确定“长向量”的定义是什么,但这几乎可以肯定是数据类型的限制,而不是系统内存。
-
如果您正在寻找 64 位版本的限制,我同意链接的 Memory-limits.html 页面令人困惑。
-
你有什么版本的 Windows,有些人为限制:msdn.microsoft.com/en-us/library/windows/desktop/…
-
笔记本电脑和备用台式机都运行 Windows 7 Enterprise edition 64-bit
标签: r memory memory-management operating-system size