[GRASS-dev] Re: [GRASS-user] r.watershed error
glynn at gclements.plus.com
Sun May 23 14:43:13 EDT 2010
Rich Shepard wrote:
> > ERROR: G_malloc: unable to allocate 18446744070980740804 bytes at ...
> > Any idea what I'm doing wrong?
> Look at the amount of memory your file wants to be allocated: several
> Petabytes. How much area is covered by that DEM and at what resolution? Even
> with GRASS compiled for large file support your file is _way_ too large.
> '%x' % 18446744070980740804
which is -2728810812
> ERROR: G_malloc: unable to allocate 18446744070980740804 bytes at
(CELL *) G_malloc(sizeof(CELL) * size_array(&alt_seg, nrows, ncols));
size_array() takes its arguments as "int", returns an "int", and
performs all calculations using "int". It appears that the result
exceeds the signed 32-bit range (2^31-1) and wraps to a negative
value, which is then promoted to 64 bits (sizeof(size_t)) before being
multiplied by 4 (sizeof(CELL)).
So while the array is large (possibly too large, depending upon the
amount of RAM available and the expected computation time), it's not
quite as insanely large as the error message appears to suggest.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev