[R] gc()

Keith S Weintraub kw1958 at gmail.com
Fri Apr 12 14:48:49 CEST 2013


Folks,
  I have some computations in a function that create some large matrices.

I have been in the habit in these circumstances to call "null out" a matrix once used and call gc().

Some pseudo code:

theFunction<-function(x, y, z, 100000000) {
   myMatrix  <- black.box.function(x, y, z, 100000000)
   interesting.data<-myFunc(myMatrix)
   myMatrix<-NULL
   gc()
   ....
   interesting.data/pi
}

Would it be different if I chose to replace myMatrix<-NULL with rm(myMatrix)?

The gc docs are fine but I was wondering if there were any other tips or links on the subject.

Thanks for your time,
KW

--



More information about the R-help mailing list