[R-sig-Epi] memory over load?
tlumley at u.washington.edu
Thu Aug 2 22:39:49 CEST 2007
On Thu, 2 Aug 2007, FZ wrote:
> Hi Thomas,
> My experience in memory management in R is very limited so I am sure you are
> right, but how do you then explain the following behavior starting with a fresh
> memory.size()# 12,000Kb
> memory.size() #approx 412,000kb
> memory.size()#still approx 412,000kb
> memory.size()#down to approx 20,000Kb
Yes, running gc() does affect the results of memory.size(), and running it more than once may have an effect, because there are three levels of garbage collection.
However, a highest-level garbage collection is always done before R gives up on allocating memory. If you run out of memory in R, adding gc() calls to your code will not help. The original question was about running out of memory.
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-sig-Epi