错误:矢量内存耗尽(达到限制?)R 3.5.0 macOS [英] Error: vector memory exhausted (limit reached?) R 3.5.0 macOS

查看:67
本文介绍了错误:矢量内存耗尽(达到限制?)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:

错误:向量内存耗尽(达到限制?)

阅读更多内容后,我发现 this 线程,它澄清了 Rstudio 的问题,并确定了一个解决方案,如下所示:

After doing some more reading, I found this thread, which clarifies the problem with Rstudio, and identifies a solution, shown below:

第一步:打开终端,

第 2 步:

cd ~
touch .Renviron
open .Renviron

第三步:将以下内容保存为.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆