[Rd] forcing gc() to do its work

Duncan Murdoch murdoch at stats.uwo.ca
Sun Feb 17 02:05:06 CET 2008

On 16/02/2008 7:56 PM, Vadim Organovich wrote:
> Hi,
> At some points of my computations I want gc() to try really hard and collect as many objects as possible even though the triggering limits are not hit. Will it help if I temporarily set the limits to some small values, call gc() and then reset them back to their original values? What variables exactly need to be set?  Does anyone have a prototype of such function?
> I tried to read the R help, e.g. Memory and memory.limits(), but I am not sure I understand how this applies to my case.

See the R Internals manual, or the comments in memory.c.  Calling gc() 
makes it try as hard as it can (a level 2 collection).  You can't make 
it try harder.

Duncan Murdoch

More information about the R-devel mailing list