[GRASSLIST:4335] PNG memory usage

cheg01 at attbi.com cheg01 at attbi.com
Tue Aug 20 02:56:03 EDT 2002


I'm trying to understand how the PNG driver uses memory. I would like to
save full 10 meter resolution images of 1:100000 quads in truecolor. I have
gd 2.0. I'm running Solaris 8 Sparc with 384 megs memory and 512 megs swap.

Environment variables:
GRASS_TRUECOLOR=TRUE
GRASS_HEIGHT=5714
GRASS_WIDTH=7469
export GRASS_TRUECOLOR GRASS_HEIGHT GRASS_WIDTH

The memory usage looks like this (from "top"):

d.mon start=PNG
PNG Size: 165M / Resident: 664K

d.erase
PNG Size: 165M / Resident: 164M

d.rast geol
PNG Size: 182 M /Resident 181 M

d.mon stop=PNG
PNG builds to Size: 346M /Resident  299M and holds for several minutes
before dropping to zero.
File map.png written to disk, 1.41 megs.


The following series does not work:
d.mon start=PNG
PNG Size: 165M / Resident: 664K

d.erase
PNG Size: 165M / Resident: 164M

d.his h_map=geol i_map=aspect
PNG runs until 30% complete, then Size exceeds 880 megs
ERROR: G_malloc: out of memory

Why does the PNG driver use > 300M of memory to create a < 2M file?
Why does d.his consume so much more memory than d.rast when both have the
same number of pixels at the same color depth?
(BTW: no memory problems occur with the monitor driver or CELL driver.)



More information about the grass-user mailing list