[R] Should garbage collection be automatic in R sessions?

Laurie Sindlinger Laurie.Sindlinger at noaa.gov
Wed Jul 30 19:36:28 CEST 2003

Hello all,

   I am having problems with memory when running R on my PC.  I do not 
have many large objects in my workspace, and yet when trying to create a 
new vector I often encounter this error message:

> lat <- header$lat[match(profile$id, header$id)]
 Error: cannot allocate vector of size 4575 Kb

Since it seems like this may indicate that I don't have enough memory available, I tried increasing nsize using mem.limits, but I still get this error message. Is there a function in R where you can see the size of all objects in the workspace? 
  When I tried using gc(), I was then able to create the vector. It seems to indicate in the help pages that the garbage collection should happen automatically. Does anyone know how often this might take place or how I can check if it is occurring during my R sessions? Thanks for you help, and I have included info about my system below (I have 1 gbyte of memory).

Laurie Sindlinger

Windows 2000

Intel(R) Pentium
(R) 4CPU 2.40 GHz
1,047,536 KB RAM

More information about the R-help mailing list