[R] Out of memory

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Aug 17 18:27:28 CEST 2002

Nikolaus Hansen wrote:
> During a R session (Version 1.4.1 under Windows) I ended up getting the following error message:

R-1.5.1 is recent.

>   Error: vector memory exhausted (limit reached?)
> independently of the command like rm(something), q(), ls(), gc(), memory.size(), memory.limit(300000000),

?memory.limit says: 

Usage: memory.limit(size = NA)
Arguments: size  [...] request a new limit, in Mb. 
So something like memory.limit(500) is more reasonable, depending on the
size of RAM in your machine.
It is much more convenient to set  --mex-mem-size=500M  at the command
line, how it works is described in the R for Windows FAQs.

> What could I do now to save my data? How could I prevent this situation?

a) Be sure a reasonable amount of memory was really allocated.
b) Rewrite your R code to consume less memory and think about what is
needed in memory at one time. Can you divide the computations into
"smaller" ones releted to memory usage?
c) Buy some more RAM.
d) Wait ten years for a much bigger computer. ;-)

Uwe Ligges
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list