[R] R Memory Issues

carl mela mela at duke.edu
Wed Oct 10 14:16:48 CEST 2001


I am running R code (version 1.3.1) on a PC with 650 Mb of RAM, and
after a number of iterations of the code (each iteraction corresponds to
a set of draws in an MCMC algorithm), the program runs out of memory
(however, the number of iterations before the code runs out of memory is
quite variable).

After each iteration in the code, I run the following lines to ascertain
the memory demanded by R:

z_sapply(ls(), function(x) object.size(get(x)))
totmem_sum(as.matrix(rev(z)))
print ("totmem")
print (totmem)

Interestingly, the total size of all of the objects does not increase
with each iteration, as the objects are overwritten from iteration to
iteration.  So, for some reason R is consuming more memory each
iteration, even though the objects do not increase in size.  I have even
tried to issue a gc() command after each iteration, but this does not
help.

I would appreciate any advice from those on this list-serv regarding how
to solve this problem.  Thanks.

--
Carl F. Mela
Associate Professor of Marketing
Fuqua School of Business
Duke University
134 Tower View Drive, Box 90120
Durham, North Carolina 27708-9012
Phone: 919-660-7767
Fax: 919-681-6245
Email: mela at duke.edu
Web: http://faculty.fuqua.duke.edu/~mela/bio

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mela.vcf
Type: text/x-vcard
Size: 381 bytes
Desc: Card for carl mela
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20011010/086624e2/mela.vcf


More information about the R-help mailing list