memory over load?
Thanks for your reply Thomas. I do understand that is the case once R
runs out of memory. I did not know about the three levels of garbage
collection though, thanks for pointing that out (I read the description
in the R-Internals).
However, my impression was that Lynn wanted to know how to free memory
to *avoid* running out of memory when running a second model ("I have
tried already rm(model1) to remove the work from the first model so that
I can run the second, but it doesn't clear out enough memory.")
Lynn, perhaps you can be more specific about your question?
Regards,
Francisco
Thomas Lumley wrote:
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 session? memory.size()# 12,000Kb x=integer(100000000) memory.size() #approx 412,000kb rm(x) memory.size()#still approx 412,000kb gc() 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
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle