R下的向量分配,RAM消耗过高

时间:2018-07-20 07:38:06

标签: r vector size

在R下遇到问题,我很困难,这很常见,“无法分配XXX GB的向量大小”。

在我的案例中,有两个过程,一个在1.1 GB的向量上失败,另一个在4.8 GB的向量上失败

我致力于以下硬件资源:具有8核处理器(Xeon E5-1620 v4 3.50 Ghz)和16 GB RAM的Windows 10 PC,我使用R 3.5.0-64位。

...我没想到我的问题可能是由于“小的” 1.1 GB向量的硬件资源造成的。

我上网尝试了几种解决方案(memory.limit,-min-vsize,R_MAX_VSIZE,-max-ppsize,高优先级和以R作为管理员执行...),但没有任何帮助。

所以我试图了解问题的根源:

*> gcinfo(TRUE)
[1] TRUE
> myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
+                                      expl.var = myExpl,
+                                      resp.xy = myRespXY,
+                                      resp.name = myRespName,
+                                      PA.nb.rep = 1,
+                                      PA.nb.absences = 5000,
+                                      PA.strategy = 'random',
+                                      PA.dist.min = ,
+                                      PA.dist.max = ,
+                                      na.rm=TRUE)
-=-=-=-=-=-=-=-=-=-=-=-=-=-= BarBar Data Formating -=-=-=-=-=-=-=-=-=-=-=-=-=-=
      ! No data has been set aside for modeling evaluation
   > Pseudo Absences Selection checkings...
   > random pseudo absences selection
   > Pseudo absences are selected in explanatory variablesGarbage collection 1459 = 967+228+264 (level 0) ...
160.5 Mbytes of cons cells used (53%)
379.5 Mbytes of vectors used (38%)
Garbage collection 1461 = 968+228+265 (level 0) ...
160.5 Mbytes of cons cells used (53%)
482.3 Mbytes of vectors used (61%)
Garbage collection 1462 = 969+228+265 (level 0) ...
160.5 Mbytes of cons cells used (53%)
659.6 Mbytes of vectors used (84%)
Garbage collection 1463 = 969+228+266 (level 2) ...
160.5 Mbytes of cons cells used (53%)
189.1 Mbytes of vectors used (24%)
...
160.5 Mbytes of cons cells used (53%)
5002.4 Mbytes of vectors used (42%)
Garbage collection 1777 = 1122+288+367 (level 2) ...
160.5 Mbytes of cons cells used (53%)
5002.4 Mbytes of vectors used (35%)
Garbage collection 1778 = 1122+288+368 (level 2) ...
160.5 Mbytes of cons cells used (53%)
9968.1 Mbytes of vectors used (56%)
Garbage collection 1779 = 1122+288+369 (level 2) ...
160.5 Mbytes of cons cells used (53%)
9968.1 Mbytes of vectors used (56%)
Garbage collection 1780 = 1122+288+370 (level 2) ...
160.5 Mbytes of cons cells used (53%)
14933.8 Mbytes of vectors used (69%)

Erreur : impossible d'allouer un vecteur de taille 1.1 Go

> myBiomodData
Erreur : objet 'myBiomodData' introuvable

>gc(TRUE)
Garbage collection 1781 = 1122+288+371 (level 2) ...
160.4 Mbytes of cons cells used (53%)
36.7 Mbytes of vectors used (0%)
          used  (Mb) gc trigger    (Mb)   max used    (Mb)
Ncells 3003244 160.4    5651730   301.9    3838487   205.0
Vcells 4801284  36.7 1880774788 14349.2 1957396291 14933.8

我了解的是分配给进程的资源已经达到最大值(memory.size(max = TRUE)返回15290.12 MB,甚至没有更改环境变量R_MAX和其他问题):进程在崩溃时崩溃14 933.8 MB几乎为15GB-> +/-我计算机上的所有可用RAM为16GB RAM,其他进程正在进行中(Windows等),但它们不足以创建1.1 Go的向量(在69 %)

因此,我的问题是:为什么R使用略大于20GB的RAM(如果69%= 15GB)来分配1.1 GB的向量?除了硬件和物理解决方案(向我的计算机添加16GB的RAM)之外,还有其他解决方案可以解决此问题吗?

0 个答案:

没有答案