[R] Memory problems using Krige (sgeostat)

Geert Aarts geert_aarts at fishgame.state.ak.us
Fri Nov 16 02:59:17 CET 2001

I’m trying to make an estimation of sea-depth for 2000 animal locations
using 2 million depth soundings. The result was:
Cannot allocate vector of size 20351 Kb

I've tried to overcome this problem by making the following adaptations.
-Increased the max-mem-size to 1.5Gb (Thanks to Thomas Lumley for his help)
-Use a max.dist (10km) for the function Krige
-Run the Krige computation for each separate animal location while using a
repeat loop
-Select only those sample locations and data (depth soundings) within a 20km
by 20km box around the animal location (So the Krige function does not need
to calculate the distance between the animal location and all the 2 million
sample locations)

However the error: cannot allocate vector of 24432 Kb still remains. For
that particular computation only 1500 sample locations and data where used.
After that computation my memory.size (TRUE) is 1,654,243,233  and
memory.size() is 654,345,998.
Does this mean that this (small) computation requires 1 Gb?

Below I outline how I heard, understood and think the memory problem is
During one computation several vectors can be created (fragmentation).
During this computation some vectors might be removed. These objects and
there associated memory are put in the garbage collection. Although the
object is removed, the memory.size() is unchanged. After the computation or
during following computation the memory in the garbage collection is
Is this correct?
And if so, does this mean that the memory is  piled up during a computation
and also during a repeat loop?

I hope somebody can help me with this.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list