Hi, I am trying to understand a potential memory leak in r.li.simpson:
NC location, using this amount of raster cells: rows: 1355 cols: 1503 cells: 2036565 (not so many!) I get this valgrind result: ==26597== LEAK SUMMARY: ==26597== definitely lost: 690,677,357 bytes in 28,777,237 blocks ==26597== indirectly lost: 115 bytes in 2 blocks ==26597== possibly lost: 205 bytes in 6 blocks ==26597== still reachable: 4,225,783 bytes in 741 blocks ==26597== suppressed: 0 bytes in 0 blocks On larger maps wants > 10GB of RAM. It happens in the linked list avl_to_array() management. ... ==26597== 129,615,648 bytes in 5,400,652 blocks are definitely lost in loss record 90 of 91 ==26597== at 0x4C279EE: malloc (vg_replace_malloc.c:270) ==26597== by 0x526CD42: G__malloc (in /usr/local/grass-7.0.0svn/lib/libgrass_gis.7.0.0svn.so) ==26597== by 0x4E3131C: avl_to_array (in /usr/local/grass-7.0.0svn/lib/libgrass_rli.7.0.0svn.so) ==26597== by 0x4E31303: avl_to_array (in /usr/local/grass-7.0.0svn/lib/libgrass_rli.7.0.0svn.so) ==26597== by 0x401C7B: calculate (in /usr/local/grass-7.0.0svn/bin/r.li.simpson) ==26597== by 0x401D8E: simpson (in /usr/local/grass-7.0.0svn/bin/r.li.simpson) ==26597== by 0x4E349D5: worker_process (in /usr/local/grass-7.0.0svn/lib/libgrass_rli.7.0.0svn.so) ==26597== by 0x4E34189: calculateIndex (in /usr/local/grass-7.0.0svn/lib/libgrass_rli.7.0.0svn.so) ==26597== by 0x573ED1C: (below main) (in /lib64/libc-2.12.so) ==26597== ... [many times] ... The code: raster/r.li/r.li.daemon/avl.c long avl_to_array(avl_node * root, long i, AVL_table * a) ... void avl_destroy(avl_tree root) used in raster/r.li/r.li.simpson/simpson.c I am not sure if the avl_destroy() doesn't leak, Help Markus _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev