[GRASS-user] Re: GRASS API questions- related with free()

Markus Metz markus.metz.giswork at googlemail.com
Fri Nov 19 12:09:33 EST 2010


Pedro Roma wrote:
> Hi Markus
> The thing is, when I run this module with valgrind, I get memory leacks (not
> much but I'm getting it) so it means that I should free it at the end.
>
To cite from a previous post, Glynn replying to me [1]:

start citation -->
Explicitly freeing memory when termination is imminent is a waste of
resources (e.g. CPU cycles, and I/O bandwidth in the case where free()
causes swapped-out memory to be swapped back in). It's colloquially
referred to as "rearranging the deckchairs on the Titanic".

...

Valgrind highlights *potential* issues; it isn't omniscient.

[Nor is it an angry god which must be appeased with a sacrifice of
SSH keys.]
<-- end citation

As I understand, you still have to investigate potential issues if
they are real issues. As I said before, I think in this case it's not
an issue because memory is allocated only once and releasing this
memory would be "rearranging the deckchairs on the Titanic".

Markus M

[1] http://lists.osgeo.org/pipermail/grass-dev/2009-April/043504.html


More information about the grass-user mailing list