[R] A question about gc()

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Sep 5 12:42:14 CEST 2006


On Tue, 5 Sep 2006, Tong Wang wrote:

> Hi everyone, 

>     I am doing some intensive computation:  50000 regressions of the 
> form Y~X with each y of size (1,1000) , even if I break invoke gc() for 
> a few time in the loop, it still breaks down at some point with the 
> error message:

gc() does not reclaim memory for you beyond what R has already done.

> Error in .signalSimpleWarning("Reached total allocation of 1024Mb: see help(memory.size)",  : 
>         recursive default argument reference

>  After getting this, even if I call gc() and resume the computation, it 
> won't move at all. May I get some suggestions what should I do to get 
> around this problem ?

Consult the rw-FAQ (since you seem to be using Windows without telling us) 
and the help page the message mentions.

It looks as if you are trying to store too many objects.  If you have lots 
of RAM you can increase that limit (see the previous para), but you are 
getting uncomfortably close to the address space limit of your OS.

Perhaps you can only save the part of the fit you need, or save() the 
objects to separate files and rm() them, and postprocess them in a later 
session?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list