R-beta: garbage collection

Jim Lindsey (jlindsey@luc.ac.be)
Mon, 2 Mar 1998 10:34:55 +0100 (MET)

From: Jim Lindsey <jlindsey@luc.ac.be>
Message-Id: <9803020934.AA09508@alpha.luc.ac.be>
Subject: R-beta: garbage collection
To: r-help@stat.math.ethz.ch (r-help)
Date: Mon, 2 Mar 1998 10:34:55 +0100 (MET)

There is something strange about the way garbage collection occurs. I
am fitting event history data which requires quite long vectors. I
have a model with 5 vectors each of about 38,000 length (R -v6) and
fit a Poisson regression - my own function with nlm - glm would
certainly not handle it.
  If I try 2 fits in a row, it tells me memory exhausted. I do gc()
and it says 35% of heap available. I do gc() and I have 80% available
and I can do another fit. Hence I have to do gc() twice between each
fit and I can continue on. Even if I wait 5-10 minutes without doing
anything, there is always only 35% available unless I use gc().
  Should not gc() be able to detect such unused memory and straighten
things out automatically when a function needs it?
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@stat.math.ethz.ch