[R] memory garbage management when updating DFs in for loops

Uri zvalim at gmail.com
Thu Feb 17 18:31:09 CET 2005


Dear R wizards,

I'm running analyses on entries residing in the database.  A FOR loop
brings in entries in batches and populates a DataFrame with them.

That is, on each run of the for loop, the DF is re-populated with values.
 I soon noticed that as the processes goes on, R's computation speed
decreases.  UNIX's "top" shows a slow increment in memory usage, and
R's gc() shows a constant increase in the Vcells-gc_trigger value.

When I manually rm() the populated dataframe at the end of each loop,
there is no increase in memory usage -- everything is completely
stable.

Is this normal behavior for R?

Cheers,
Uri Hasson.




More information about the R-help mailing list