[R] memory allocation failures

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 21 09:34:38 CEST 2005


Most likely your linear model fitting is too large for the amount of 
memory you have in your Windows box.  However, you should check ?Memory 
and in particular how your maximum RAM usage is set.  (I don't know how 
the `JGR JRI tools' give you access to R's startup settings.)

It may be that you are creating lots of large objects and so filling 
memory that way: try running gc() before the call to check your memory 
usage.  If so, you can remove (or save()) previous work.

On Mon, 20 Jun 2005, Matthew Padilla wrote:

> Hi,
>
> I am running R version rw2010 on a Windows 2000 desktop.  I am invoking R
> from Java via the JGR JRI tools.  My process consists of repeated calls to R
> in order to create linear models and process the resulting statistics.  I
> find, however, that the process often dies due to memory allocation errors:
>
> lm command:
> .model_resp10_1=lm(resp10_1~rannor10+rannor11+rannor13+rannor14+rannor15+rannor18+rannor23+rannor26+rannor28+rannor29+rannor32+rannor33+rannor35+rannor36+rannor39+rannor40+rannor43+rannor44+rannor46+rannor47+rannor48+rannor50+rannor51+rannor53+rannor55+rannor56+rannor57+rannor59).
> Garbage collection 172 = 54+41+77 (level 2) ...
> 626936 cons cells free (75%)
> 12.5 Mbytes of heap free (15%)
> Error: cannot allocate vector of size 2265 Kb
>
> I have tried to remedy this situation by corresponding calls to gc(), but
> this does not seem to fix the problem.  My files are not that large - about
> 1000 records.  Additionally, general communication to R from Java from JRI
> does seem to work - I only run into problems when repeatedly creating models
> as demonstrated above.
>
> Any help would be greatly appreciated - I am very much an R newbie.
>
> Thank you,
> Matthew
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
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