错误:向量内存已耗尽(是否达到极限?)R 3.5.0 macOS [英] Error: vector memory exhausted (limit reached?) R 3.5.0 macOS
问题描述
我使用包含基因表达数据的大文件已经有一段时间了,最近在升级到R 3.5.0之后,将数据加载到R中遇到了一个问题.使用大约8GB的内存(我的Mac具有16GB的RAM)后,如果尝试读取另一个文件,则会出现以下错误:
I've been working for a while with a number of large files containing gene expression data, and I've recently run into an issue with loading that data into R, after upgrading to R 3.5.0. After using about 8GB of memory (my mac has 16GB of RAM), if I try to read in another file, I get the following error:
Error: vector memory exhausted (limit reached?)
我找到了以前的帖子(错误:矢量内存已耗尽(达到限制了吗?))建议我尝试将环境变量R_MAX_VSIZE设置为更高的值,因此我尝试了以下操作:
I found a previous post (Error: vector memory exhausted (limit reached?)) suggesting I try to set the environmental variable R_MAX_VSIZE to a higher value, so I tried the following:
Sys.setenv(R_MAX_VSIZE = 16e9)
但是,我仍然遇到相同的错误.我是否正确设置了环境变量?有什么我想念的吗?
However, I still got the same error. Am I not setting the environmental Variable correctly? is there something that I'm missing?
会话信息:
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages: [1] data.table_1.11.4
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0
推荐答案
对于使用Rstudio的用户,我发现设置Sys.setenv('R_MAX_VSIZE'=32000000000)
仅在命令行上有效,并且在使用Rstudio时设置该参数不会阻止此操作.错误:
For those using Rstudio, I've found that setting Sys.setenv('R_MAX_VSIZE'=32000000000)
only works on the command line, and that setting that parameter while using Rstudio does not prevent this error:
Error: vector memory exhausted (limit reached?)
After doing some more reading, I found this thread, which clarifies the problem with Rstudio, and identifies a solution, shown below:
第1步:打开终端,
第2步:
cd ~
touch .Renviron
open .Renviron
第3步:将以下内容保存为.Renviron
的第一行:
Step 3: Save the following as the first line of .Renviron
:
R_MAX_VSIZE=100Gb
注意:此限制包括物理内存和虚拟内存.因此,在具有16Gb物理内存的计算机上设置_MAX_VSIZE = 16Gb可能不会防止此错误.您可能必须使用此参数,具体取决于计算机的规格
Note: This limit includes both physical and virtual memory; so setting _MAX_VSIZE=16Gb on a machine with 16Gb of physical memory may not prevent this error. You may have to play with this parameter, depending on the specs of your machine
这篇关于错误:向量内存已耗尽(是否达到极限?)R 3.5.0 macOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!