The hash package implements hashmaps which must be cleared prior to
removal to free memory, e.g.:

> x <- hash(some_long_list_of_keys_and_values_here)
> clear(x)
> rm(x)

I first assumed this held for re-assignment, too... e.g. one should:

> x <- hash(some_long_list_of_keys_and_values_here)
> clear(x)
> x <- hash(some_other_long_list_of_keys_and_values_here)

With the clear(x) between the re-assignment of x to prevent memory leaks.

After some testing, though, I'm now not so sure.
I basically repeated this cycle:

> x <- hash(randomly_generated_long_list_of_keys_and_values_here)
> gc()

Memory usage grew only in the first few (3) cycles of this, but then
remained stable as x continued to be re-assigned.
Does anyone know if the assignment operator for a hash object has been
written to force a clear() operation?

Cheers,

-m

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to