6

Possible Duplicate:
Forcing garbage collection to run in R with the gc() command

I was wondering if some of my code would benefit from executing a garbage collection - i.e.

> gc()

From the gc help, I read "A call of gc causes a garbage collection to take place. This will also take place automatically without user intervention, and the primary purpose of calling gc is for the report on memory usage".

I'm pretty careful to remove large objects after they are no longer needed, but I feel like the speed of my operations continues to decrease during a session. I haven't noticed a substantial improvement through using gc() periodically - and it appears from the above description that this operation happens automatically from time to time. Does anyone have suggestions on its proper application?

Cheers

Community
  • 1
  • 1
Marc in the box
  • 11,769
  • 4
  • 47
  • 97
  • If just found some good tips here: http://stackoverflow.com/questions/1467201/forcing-garbage-collection-to-run-in-r-with-the-gc-command although there are several "philosophies" therein. – Marc in the box May 09 '12 at 09:13
  • ...So I vote to close this one since the other already answers the question... – Tommy May 09 '12 at 09:32
  • (and I added another answer to the other question). http://stackoverflow.com/a/10513504/662787 – Tommy May 09 '12 at 09:41

0 Answers0