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

Jonathan Greenberg greenberg at ucdavis.edu
Wed Jul 1 22:43:38 CEST 2009


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

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.  So 
> the question is, with 20Gb of RAM free how come I can't create more 
> than one matrix of this size?  (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.)
>
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 

Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Cell: 415-794-5043
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307




More information about the R-help mailing list