[GRASS-dev] Re: IMPORTANT: [GRASS GIS] #837: Memory leaks in r.example

Glynn Clements glynn at gclements.plus.com
Mon Dec 21 01:16:32 EST 2009


Hamish wrote:

> > > #837: Memory leaks in r.example
> > 
> > Contrary to my original assessment, this is an important
> > issue. There is a significant memory leak caused by the null
> > bitmap handling, and we need to decide what to do about it for
> > 6.4 (for 7.x, I intend to overhaul the null bitmap handling,
> > but that may be too disruptive for 6.4).
> 
> for the 6.4.0 release we should hold any changes, it will have
> gone this many years already without being a major problem, it
> can wait a little longer.

Actually, it only dates back to Jan-Feb 2008. Prior to that, there was
a bug where G_open_* could free elements of the mapset path.

Essentially, you don't know whether it's safe to free the mapset
string returned from G_find_*. If it isn't and you free it, it can
cause a crash. If it is and you don't free it, you've leaked some
memory.

Most of the time this isn't a problem, but the null bitmap code calls
these functions every NULL_ROWS_INMEM (== 8) rows. For large maps (or
for large numbers of maps, e.g. r.series), this could add up (even if
mapset names are short, there's an overhead for each malloc()'d
block).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list