[R] R not giving memory back to system?

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 27 09:25:04 CET 2001


On Mon, 26 Nov 2001, Gardar Johannesson wrote:

> This might be because I didn't get it right, but; I thought R would
> release memory back to the system as (big) objects get removed?
>
> Here is my platform (with 1Gb of RAM):
>
> platform sparc-sun-solaris2.8
> arch     sparc
> os       solaris2.8
> system   sparc, solaris2.8
> status
> major    1
> minor    3.1
> year     2001
> month    08
> day      31
> language R

[...]

> My question is; are gc() and unix top telling the same memory story?  If
> not, which one is not getting it right?

No, so both are right in different ways.

They are referring to very different things.  gc() to the maximum amount
of memory that R will use before garbage collection and the amount
currently in use.  top refers to the amount that the malloc system has
marked as in use.  In my experience on Solaris the latter very rarely goes
down, but it does get swapped out.  On my Linux system it goes down, but
not by as much as it went up.

R does release memory back to the malloc system: what happens thereafter
is very machine (and even compiler) dependent.

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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