[R-SIG-Mac] [R] "Error: cannot allocate vector of size 332.3 Mb"

David Winsemius dwinsemius at comcast.net
Thu Jul 2 13:32:50 CEST 2009


On Jul 1, 2009, at 4:43 PM, Jonathan Greenberg wrote:

> By the way, you'll probably have to reinstall some or all of your  
> packages (and dependencies) if you are using R64.app, probably  
> downgrading them in the process.
>
> --j

This really ought to be on the r-sig-mac list. I am copying that list  
and follow-ups to any of these comments ought to trim the r-help  
address.

It is certainly true that packages will need to be reinstalled, but I  
am puzzled by the comment about "probably downgrading". My experience  
is that current versions of packages are almost always available on  
CRAN. The R.app 64 bit GUI provides for compiling from source and only  
a few packages fail to compile for the Mac OS X 10.5.x 64-bit  
architecture.

-- 
DW
>
> Steve Ellis wrote:
>> Dear R-helpers,
>>
>> I am running R version 2.9.1 on a Mac Quad with 32Gb of RAM running  
>> Mac OS X version 10.5.6.  With over 20Gb of RAM "free" (according  
>> to the Activity Monitor) the following happens.
>>
>>    > x <- matrix(rep(0, 6600^2), ncol = 6600)
>>
>>    # So far so good.  But I need 3 matrices of this size.
>>
>>    > y <- matrix(rep(0, 6600^2), ncol = 6600)
>>    R(3219) malloc: *** mmap(size=348483584) failed (error code=12)
>>    *** error: can't allocate region
>>    *** set a breakpoint in malloc_error_break to debug
>>    R(3219) malloc: *** mmap(size=348483584) failed (error code=12)
>>    *** error: can't allocate region
>>    *** set a breakpoint in malloc_error_break to debug
>>    Error: cannot allocate vector of size 332.3 Mb
>>
>> Now a 6600 x 6600 matrix should take up less than 400Mb of RAM.

Correct. On a Mac:
x <- matrix(rep(0, 6600^2), ncol = 6600)
 > object.size(x)
[1] 348480200

>>  So the question is, with 20Gb of RAM free how come I can't create  
>> more than one matrix of this size?

I am unable to reproduce that problem with "only" 10GB installed.

>>  (In fact, sometimes R won't even create one of them.)  More to the  
>> point, is there some simple remedy? (Rewriting all my code to use  
>> the "Matrix" library, for example, is not a simple remedy.)

Some part of your installation is faulty. You should not need to use  
the 64 bit version to get those matrices created. Discuss further on  
the r-sig-mac list.


>>
>> I tried launching R in a terminal with
>>
>>    R --min-vsize=10M --max-vsize=5G --min-nsize=500k --max-nsize=900M
>>
>> and that didn't work either.  Finally, let me remark that I had the  
>> same problem with an older version of R.
>>
>>  -- Steve Ellis
>>
>> __________________________________

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-SIG-Mac mailing list