Garbage collection


#1

When I use data.table to work with large data sets, does using gc() after some intermediate data are removed improve speed?


#2

Any suggestions? ..................


#3

short answer no, you should never call gc yourself. a explaination can be found on stackoverflow but I'm on mobile right now.


#4

Can you elaborate on it with more details? Thanks.


#5

There is a section on garbage collection in Advanced R.

You can force the garbage collector to run by calling gc() . Despite what you might have read elsewhere, there’s never any need to call gc() yourself. You may want to call gc() to ask R to return memory to your operating system, or for its side-effect of telling you how much memory is currently being used