I have a program which reads in a very large data set, performs some analyses, and then repeats this process with another data set. As soon as the first set of analyses are complete, I remove the very large object and clean up to try and make memory available in order to run the second set of analyses. The process looks something like this:

1) read in data set 1 and perform analyses
rm(list=ls())
gc()
2) read in data set 2 and perform analyses
rm(list=ls())
gc()
...

But, it appears that I am not making the memory that was consumed in step 1 available back to the OS as R complains that it cannot allocate a vector of size X as the process tries to repeat in step 2. 

So, I close and reopen R and then drop in the code to run the second analysis. When this is done, I close and reopen R and run the third analysis. 

This is terribly inefficient. Instead I would rather just source in the R code and let the analyses run over night.

Is there a way that I can use gc() or some other function more efficiently rather than having to close and reopen R at each iteration?

I'm using Windows XP and r 2.6.1

Harold

	[[alternative HTML version deleted]]

