Error: cannot allocate vector of size XX Gb
目录
Error: cannot allocate vector of size XX Gb
#问题
x <- rnorm(4000000000)
# Trying to run rnorm function
# Error: cannot allocate vector of size 29.8 Gb
#解决
#垃圾回收;
gc()
#空间依旧不够
x <- rnorm(4000000000)
# Trying to run rnorm function
# Error: cannot allocate vector of size 29.8 Gb
#增大内存
#查看分配的内存大小
memory.limit()
# Check currently set limit
# [1] 16267
#增大分配的内存
memory.limit(size = 35000)
# Increase limit
# [1] 35000
x <- rnorm(4000000000)
# Successfully running rnorm function
参考:R
参考:R Error: Cannot Allocate Vector of Size N GB (2 Examples) | How to Increase the Memory Limit