[GRASS-dev] Improving the G_calloc: unable to allocate xx bytes of memory message?

Markus Neteler neteler at osgeo.org
Mon Oct 27 11:20:41 PDT 2014


On Mon, Oct 27, 2014 at 6:42 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> Markus Neteler wrote:
>
>> GRASS 7.1.svn (nc_spm_08_grass7):~ > v.to.rast roadsmajor out=test
>> use=attr attrcol=PROPYEAR memory=3000000 --o
>> WARNING: No areas selected from vector map <roadsmajor>
>> Current region rows: 135000, cols: 150000
>> ERROR: G_calloc: unable to allocate 18446744072484715136 * 4 bytes of
>>        memory at vector/v.to.rast/raster.c:84
>
> $ printf '%x' 18446744072484715136
> ffffffffb6fe7a80
>
> Those leading "f"s are a giveway. It's almost certain that a
> calculation was done with 32-bit arithmetic, which overflowed to
> produce a negative result (0xb6fe7a80 = -1224836480), which was then
> converted to 64 bits with sign extension, then cast to unsigned.
>
>> ... only, it does not return to command line (have to use CTRL-C).
>
> It's possible that memory corruption has already occurred, resulting
> in e.g. an infinite loop.

[...]

In any case I would suggest to submit this patch to SVN since it helps
the user to understand where the issue happens.

thanks
Markus


More information about the grass-dev mailing list