简体   繁体   English

尽管是64位版本,但无法在R中分配向量

[英]Cannot allocate vector in R despite being in 64-bit version

I am trying to do a dcast in R to generate a matrix as seen in another question I asked 我正试图在R中做一个dcast来生成一个矩阵,如我问的另一个问题所示

However, I am getting an error: 但是,我收到一个错误:

Error: cannot allocate vector of size 2.8Gb. 错误:无法分配大小为2.8Gb的向量。

My desktop has 8GB of RAM and I am running ubuntu 11.10 64-bit version. 我的桌面有8GB的RAM,我正在运行ubuntu 11.10 64位版本。 Am I perhaps using the wrong version of R? 我可能使用了错误的R版本吗? How would I know, is there a way to determine it while running R? 我怎么知道,有没有办法在运行R时确定它? I surely must have the necessary space to allocate this vector. 我当然必须有足够的空间来分配这个载体。

The error message means that R needs to allocate another 2.8Gb of memory to complete whatever operation you were trying to perform. 错误消息意味着R需要分配另外 2.8Gb的内存来完成您尝试执行的任何操作。 It doesn't mean it needed to allocate 2.8Gb maximum. 这并不意味着它需要分配2.8Gb的最大值。 Run top in a shell whilst you run that R code and watch how R uses up memory until it hist a point where the extra 2.8Gb of address space is not available. 在运行R代码的同时在shell中运行top并观察R如何占用内存,直到它划分出额外的2.8Gb地址空间不可用的点。

Do you have a large swap space on the box. 你的盒子上有一个大的交换空间吗? I can easily see how what you are doing uses all 8Gb of RAM plus all your swap space and so there is no other place for R to get memory space from and thus throws the error. 我可以很容易地看到你正在做什么使用所有8Gb的RAM加上你所有的交换空间,所以R没有其他地方可以从中获取内存空间,从而抛出错误。

Perhaps you could try doing the dcast in chunks, or try an alternative approach than using dcast. 也许您可以尝试以块的形式进行dcast,或尝试使用替代方法而不是使用dcast。 Post another Q if you want help with that. 如果您需要帮助,请发布另一个Q.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM