[GRASS-dev] r.contour - G_malloc:out of memory

William Kyngesburye woklist at kyngchaos.com
Mon Sep 22 10:00:12 EDT 2008


On Sep 22, 2008, at 8:13 AM, Glynn Clements wrote:

>> The file size on disk is 1.22 GB. I have 8 GB RAM, whereof 5929 MB
>> free when I execute r.contour on the command line. r.contour fails
>> with the following message after reading in ca. 25% of the data
>> (reproduceable):
>>
>> GRASS 6.3.0 (NovZem(old)):~ > r.contour --overwrite
>> input=NovZem_S_highrres_red at enhanced output=NovZem_shoreline levels=1
>> Reading data:
>> r.contour(13162) malloc: *** mmap(size=405504) failed (error code=12)
>> *** error: can't allocate region
>> *** set a breakpoint in malloc_error_break to debug
>> ERROR: G_malloc: out of memory
>>
>> This happens while 3020 MB memory are still free! On the other hand  
>> it
>> means that r.contour used ca. 3 GB of memory for load ca. 300 MB of
>> data from the disk, i.e. the whole 1.22 GB dataset would require ca.
>> 12 GB of free memory.
>>
>> Is this behaviour expected?
>
> Yes.
>
> You have ~2G (2^31) cells. Each one is stored internally as a 64-bit
> floating-point value[1], meaning that it would require ~16GiB of
> memory.
>
> Try reducing the region resolution.
>
> Note that the file in question is compressed, and only uses 1 byte per
> cell when decompressed.
>
> [1] which is probably overkill; a 32-bit value would likely suffice.
> However, that might still be problematic in this particular case,
> depending upon how much memory is required for other purposes.
>
Also note that in a 32bit OSX build (what my binaries are) you will  
have memory problems at the 2GB (maybe 4GB?) mark.  It doesn't matter  
if you're running on a 64bit Mac.

I don't build 64bit GRASS because there are some myterious problems in  
the vector library that haven't been worked out.  Damn, I keep  
forgetting to submit a bug report.


-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Those people who most want to rule people are, ipso-facto, those  
least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy




More information about the grass-dev mailing list