[R-SIG-Mac] memory allocation problems

Kasper Daniel Hansen khansen at stat.Berkeley.EDU
Mon Jun 30 19:04:00 CEST 2008


Like Sean is aying, you most likely are using _way_ more memory than  
1.2 GB.

However, if you a re running 32bit R (which is the case if you use the  
CRAN binary) R can only access 2GB, so you can squeeze a little more  
out of your machine by switching to a 64bit version of R. You can  
check what version you have by typing
R> .Machine
and look for sizeof.pointer - if it is 4 you are using 32bit, if it is  
8 you are using 64 bit.

If you want the 64 bit version of R you can download a binary from  
Simon's page: r.research.att.com , but you need to also get the  
preview build of GCC 4.2 which is available from Apple's developer  
site (although hard to find these days).

Kasper

On Jun 30, 2008, at 3:23 AM, Sean Davis wrote:

> On Sun, Jun 29, 2008 at 6:35 AM, Antonio P. Ramos
> <ramos.grad.student at gmail.com> wrote:
>> Hi everybody,
>>
>> I have a memory allocation problem while using  R in my macbook pro,
>> which runs the latest leopard. I'm trying to run a monte carlo
>> simulation with 500,000 interactions, but the machine failed:
>>
>>
>> Starting MCMC Iterations...
>> Error: cannot allocate vector of size 1.2 Gb
>> R(176,0xa0640fa0) malloc: *** mmap(size=1239990272) failed (error  
>> code=12)
>> *** error: can't allocate region
>> *** set a breakpoint in malloc_error_break to debug
>> R(176,0xa0640fa0) malloc: *** mmap(size=1239990272) failed (error  
>> code=12)
>> *** error: can't allocate region
>> *** set a breakpoint in malloc_error_break to debug
>>
>>
>> Since my machine has 4 Gb of memory, and since I'm not running  
>> nothing
>> in addition to the simulation, I found it strange. This is my  
>> machine:
>>
>> Model Identifier:     MacBookPro3,1
>> Processor Name:       Intel Core 2 Duo
>> Processor Speed:      2.4 GHz
>> Memory:       4 GB
>>
>>
>> Unfortunately, I could figure it out how to solve it. Any help?
>
> The error message above means that R failed to allocate a vector of
> size 1.2Gb.  That doesn't mean that R was using only 1.2 Gb, but that
> it was trying to allocate a new block of memory of that size in
> addition to the memory that was already in use.  The system on the Mac
> uses a fair amount of memory; R was probably using memory as well.  In
> short, you probably need more memory or be more clever about how you
> are using the memory you have.  Without more details about what you
> are doing, it is difficult to know how to change the latter.
>
> Sean
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list