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

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Jul 30 20:12:12 CEST 2003

Laurie Sindlinger wrote:
> 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?

See ?memory.size and ?memory.limit

>   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).

See ?gcinfo

Uwe Ligges

> Sincerely,
> Laurie Sindlinger
> Windows 2000
> Intel(R) Pentium
> (R) 4CPU 2.40 GHz
> 1,047,536 KB RAM
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

More information about the R-help mailing list