[R] How to free memory used by R.

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Sep 1 19:54:17 CEST 2003

On Mon, 1 Sep 2003, Thomas Lumley wrote:

> On Mon, 1 Sep 2003, Lariani,Sofiane,LAUSANNE,NRC/BAS wrote:
> > Hi,
> > I want to free memory used by R. The usage of rm and gc give no result. I'm
> > running  an algorithm consuming a huge memory and I need to recover the
> > memory used by R between 2 call of my algorithm.
> > Thank you in advance for your help.
> There is no portable way (and often no way at all) for a program to return
> memory to the operating system.
> On the other hand, a competent virtual memory system will page unused
> memory to disk fairly quickly, which has more or less the same effect
> unless you are short of disk space.

Or short of address space.  This is an increasing issue for 32-bit 
machines: you can have 100Gb of disc space, but the per-process address 
space may only be 2-4Gb.  It's certainly the limit running R under 

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