[R] Dealing with xmalloc: out of virtual memory

Don MacQueen macq at llnl.gov
Wed Oct 9 21:05:35 CEST 2002

I have a file of R code which I source().
The code has this structure:

repeat {
   ## check size of each of sixteen files
   ## if any of the file sizes has increased, then
   ##     read the last 65 lines of all the files
   ##     do a few computations, make a plot

With the intention of using Ctrl-C to manually break the loop when desired.

I set this thing running yesterday afternoon, and came in this 
morning to find it had crashed with this message
    xmalloc: out of virtual memory
and returned to the OS.

None of my objects are large, but they are repeatedly being 
overwritten so maybe  the following note from the online FAQ (section 
7.1) is relevant?

    "The new garbage collector does not move objects in memory, 
meaning that it is possible for the free memory to become fragmented 
so that large objects cannot be allocated even when there is 
apparently enough memory for them."

I've done some searching in the R-help archives, the various 
reference documents, the FAQ, but haven't yet found anything that I 
recognize as a solution.

I've some ideas, i.e., execute memory.profile() or gc() periodically 
to watch what's happening. In the meantime, I would appreciate 


Version information:

>  version
platform sparc-sun-solaris2.7
arch     sparc
os       solaris2.7
system   sparc, solaris2.7
major    1
minor    6.0
year     2002
month    10
day      01
language R

Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
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