[GRASS5] Re: Vector points and topology

Radim Blazek radim.blazek at gmail.com
Fri Aug 5 08:19:27 EDT 2005


I have explained it in one mail already, it is intention
that free is not called by default (GRASS modules)
but it can be if necessary (QGIS).
Hamish also made new tests with free forced.

Radim

On 7/29/05, Markus Neteler <neteler at itc.it> wrote:
> Hi,
> 
> I was looking again (a bit) at the potential memory leak
> of the vector library.
> 
> Hamish's analysis
>  http://bambi.otago.ac.nz/hamish/grass/memleak/v.in.ascii/
> indicates
>   The main offenders are:
>     RTreeNewNode (node.c:47)
>     dig_alloc_node (struct_alloc.c:46)
>     dig_alloc_lines (struct_alloc.c:130)
> 
> Looking at the code:
> 
> lib/vector/rtree > grep RTreeNewNode *.c
> index.c:        x = RTreeNewNode();
> index.c:                newroot = RTreeNewNode();  /* grow a new root, & tree taller */
> node.c:struct Node * RTreeNewNode(void)
> split_l.c:      *nn = RTreeNewNode();
> split_q.c:      *nn = RTreeNewNode();
> 
> I see that RTreeNewNode() - which uses malloc() is used a couple of times
> but probably free() isn't used where needed:
> 
> lib/vector/rtree > grep free *.c | grep -iv 'free software'
> index.c:        free(p);
> node.c: free(p);
> node.c:/* Destroy (free) node recursively. */
> 
> Maybe someone knowing more that me could inspect if a free() is
> missing here? RTreeNewNode(), according to valgrind, seems to
> cause some troubles.
> 
> Markus
> 
>




More information about the grass-dev mailing list