Skip to content

Out of memory

2 messages · Nikolaus Hansen, Uwe Ligges

#
During a R session (Version 1.4.1 under Windows) I ended up getting the following error message:

  Error: vector memory exhausted (limit reached?)

independently of the command like rm(something), q(), ls(), gc(), memory.size(), memory.limit(300000000), ...

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

Thanks for any hint, 
Nikolaus Hansen
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
2 days later
#
Nikolaus Hansen wrote:
R-1.5.1 is recent.
?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.
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._