[GRASS-dev] Possible memory leak in G__open_cell_old in opencell.c

Glynn Clements glynn at gclements.plus.com
Mon Mar 18 13:19:08 PDT 2013

matteo poletti wrote:

> I found the problem: since I had a file the descriptor I closed it
> with the function close.
> I didn't know that I need to call the function G_close_cell instead
> to deallocate the structures related to the file descriptor.

In GRASS 7, the value returned from the Rast_open_* functions (and
passed to other raster functions to identify a map) isn't a file
descriptor, but an index into a table of open maps.

In earlier versions, the value is both the descriptor of the open cell
file and an index into the table of open maps, so it's still necessary
to close maps with G_close_cell() or G_unopen_cell() in order to
release other resources associated with the map.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list