#14: v.distance: memory leak in LatLong?
---------------------+------------------------------------------------------
Reporter: neteler | Owner: grass-dev@lists.osgeo.org
Type: defect | Status: new
Priority: major | Milestone: 6.3.0
Component: default | Version: svn-trunk
Keywords: |
---------------------+------------------------------------------------------
It seems that v.distance has a memory leak when run in LatLong locations
(version from today):
{{{
GRASS 6.3.svn (latlong_sphere):~ > CMD="v.distance -p -a
coordinate_all_flocks_map to=coordinate_all_flocks_map upload=dist
col=distance"
GRASS 6.3.svn (latlong_sphere):~ > valgrind --tool=memcheck --leak-
check=yes --show-reachable=yes $CMD --o
==7781== Memcheck, a memory error detector.
==7781== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==7781== Using LibVEX rev 1732, a library for dynamic binary translation.
==7781== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==7781== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==7781== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==7781== For more details, rerun with: -v
==7781==
==7781==
==7781== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 2)
==7781== malloc/free: in use at exit: 61,509,846 bytes in 2,220,194
blocks.
==7781== malloc/free: 2,708,254 allocs, 488,060 frees, 2,338,934,443 bytes
allocated.
==7781== For counts of detected errors, rerun with: -v
==7781== searching for pointers to 2,220,194 not-freed blocks.
==7781== checked 12,072,696 bytes.
==7781==
==7781== 1 bytes in 1 blocks are still reachable in loss record 1 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x745EC92: __static_initialization_and_destruction_0(int,
int) (PlanarGraph.cpp:24)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 1 bytes in 1 blocks are still reachable in loss record 2 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x747AE94: __static_initialization_and_destruction_0(int,
int) (GeometryGraphOperation.cpp:21)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 8 bytes in 1 blocks are still reachable in loss record 3 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x748D943: __static_initialization_and_destruction_0(int,
int) (RelateComputer.cpp:48)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 24 bytes in 1 blocks are still reachable in loss record 4 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x743A508: geos::GeometryFactory::GeometryFactory()
(GeometryFactory.cpp:29)
==7781== by 0x74356D4: __static_initialization_and_destruction_0(int,
int) (Geometry.cpp:129)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 32 bytes in 1 blocks are still reachable in loss record 5 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x74356C9: __static_initialization_and_destruction_0(int,
int) (Geometry.cpp:129)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 32 bytes in 1 blocks are still reachable in loss record 6 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x746AC92: __static_initialization_and_destruction_0(int,
int) (QuadTreeRoot.cpp:26)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 48 bytes in 1 blocks are still reachable in loss record 7 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x74A4E04: __static_initialization_and_destruction_0(int,
int) (Profiler.cpp:20)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 96 bytes in 3 blocks are still reachable in loss record 8 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x4E46140: Vect__new_line_struct (line.c:50)
==7781== by 0x4E4610C: Vect_new_line_struct (line.c:39)
==7781== by 0x403583: main (main.c:420)
==7781==
==7781==
==7781== 232 bytes in 5 blocks are still reachable in loss record 9 of 28
==7781== at 0x4C1ECBF: calloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5289B5D: G_calloc (alloc.c:72)
==7781== by 0x52ACF99: G_parser (parser.c:754)
==7781== by 0x4028A1: main (main.c:212)
==7781==
==7781==
==7781== 304 bytes in 1 blocks are still reachable in loss record 10 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x747AEA8: __static_initialization_and_destruction_0(int,
int) (GeometryGraphOperation.cpp:22)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 304 bytes in 1 blocks are still reachable in loss record 11 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x748D924: __static_initialization_and_destruction_0(int,
int) (RelateComputer.cpp:47)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 556 bytes in 12 blocks are possibly lost in loss record 12 of 28
==7781== at 0x4C201A5: operator new(unsigned long) (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==7781== by 0x9E8F530: std::string::_Rep::_S_create(unsigned long,
unsigned long, std::allocator<char> const&) (in
/usr/lib64/libstdc++.so.6.0.8)
==7781== by 0x9E90034: (within /usr/lib64/libstdc++.so.6.0.8)
==7781== by 0x9E901E1: std::string::string(char const*,
std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.8)
==7781== by 0x749398B: __static_initialization_and_destruction_0(int,
int) (TopologyValidationError.cpp:33)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 568 bytes in 1 blocks are still reachable in loss record 13 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x6EE18A9: (within /lib64/libc-2.4.so)
==7781== by 0x52A4B57: G_read_key_value_file (key_value3.c:25)
==7781== by 0x529DAF2: G_get_ellipsoid_parameters (get_ellipse.c:78)
==7781== by 0x52976AD: G_begin_distance_calculations (distance.c:51)
==7781== by 0x4E47687: Vect_line_geodesic_length (line.c:526)
==7781== by 0x403C41: main (main.c:518)
==7781==
==7781==
==7781== 960 bytes in 2 blocks are still reachable in loss record 14 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5289BC7: G_realloc (alloc.c:106)
==7781== by 0x4E3CCFC: Vect_add_dblink (field.c:198)
==7781== by 0x4E3DA70: Vect_read_dblinks (field.c:550)
==7781== by 0x4E4E30A: Vect__open_old (open.c:313)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 2,272 bytes in 4 blocks are still reachable in loss record 15 of
28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x6EE11D5: fdopen (in /lib64/libc-2.4.so)
==7781== by 0x52A9953: G_fopen_old (open.c:263)
==7781== by 0x4E4F211: V1_open_old_nat (open_nat.c:45)
==7781== by 0x4E4E105: Vect__open_old (open.c:267)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 3,748 bytes in 14 blocks are still reachable in loss record 16 of
28
==7781== at 0x4C1ECBF: calloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5D327DE: dig__alloc_space (allocation.c:93)
==7781== by 0x5D3C70D: buf_alloc (portable.c:58)
==7781== by 0x5D3C9DE: dig__fread_port_L (portable.c:170)
==7781== by 0x5D3B621: dig_Rd_Plus_head (plus_struct.c:556)
==7781== by 0x4E4EED4: Vect_open_topo (open.c:693)
==7781== by 0x4E4DEEB: Vect__open_old (open.c:212)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 6,144 bytes in 12 blocks are definitely lost in loss record 17 of
28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5F47502: RTreeNewNode (node.c:47)
==7781== by 0x5F46608: RTreeNewIndex (index.c:27)
==7781== by 0x5D3E3B2: dig_spidx_init (spindex.c:38)
==7781== by 0x5D36BA0: dig_init_plus (plus.c:112)
==7781== by 0x4E4DA6A: Vect__open_old (open.c:137)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 7,280 bytes in 7 blocks are still reachable in loss record 18 of
28
==7781== at 0x4C1ECBF: calloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x6EB6837: (within /lib64/libc-2.4.so)
==7781== by 0x6EB6890: __cxa_atexit (in /lib64/libc-2.4.so)
==7781== by 0x74A5E15: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781== by 0x7429AAA: (within /home/usr_local/lib/libgeos.so.2.2.3)
==7781==
==7781==
==7781== 8,060 bytes in 149 blocks are possibly lost in loss record 19 of
28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5289AE7: G_malloc (alloc.c:39)
==7781== by 0x52A450B: G_set_key_value (key_value1.c:51)
==7781== by 0x52A4A5F: G_fread_key_value (key_value2.c:45)
==7781== by 0x52A4B7F: G_read_key_value_file (key_value3.c:31)
==7781== by 0x529DAF2: G_get_ellipsoid_parameters (get_ellipse.c:78)
==7781== by 0x52976AD: G_begin_distance_calculations (distance.c:51)
==7781== by 0x4E47687: Vect_line_geodesic_length (line.c:526)
==7781== by 0x403D6B: main (main.c:523)
==7781==
==7781==
==7781== 32,000 bytes in 2 blocks are still reachable in loss record 20 of
28
==7781== at 0x4C1FA97: realloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5D3683F: dig_list_add (list.c:44)
==7781== by 0x5D3EBC0: _add_item (spindex.c:299)
==7781== by 0x5F4681F: RTreeSearch (index.c:66)
==7781== by 0x5F46766: RTreeSearch (index.c:55)
==7781== by 0x5F46766: RTreeSearch (index.c:55)
==7781== by 0x5F46766: RTreeSearch (index.c:55)
==7781== by 0x5F46766: RTreeSearch (index.c:55)
==7781== by 0x5D3EDB6: dig_select_lines (spindex.c:376)
==7781== by 0x4E542F4: Vect_select_lines_by_box (select.c:54)
==7781== by 0x4039BA: main (main.c:496)
==7781==
==7781==
==7781== 91,898 bytes in 821 blocks are still reachable in loss record 21
of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5289AE7: G_malloc (alloc.c:39)
==7781== by 0x52C32BD: G_store (store.c:36)
==7781== by 0x52B5BE9: G_set_program_name (progrm_nme.c:53)
==7781== by 0x52A1B5A: G_gisinit (gisinit.c:46)
==7781== by 0x402330: main (main.c:106)
==7781==
==7781==
==7781== 207,872 bytes in 12,996 blocks are still reachable in loss record
22 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x4C1FA10: realloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5D3FF34: dig_alloc_nodes (struct_alloc.c:98)
==7781== by 0x5D37072: dig_load_plus (plus.c:320)
==7781== by 0x4E4EFC3: Vect_open_topo (open.c:720)
==7781== by 0x4E4DEEB: Vect__open_old (open.c:212)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 311,712 bytes in 6,494 blocks are still reachable in loss record
23 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5D3FDE5: dig_alloc_node (struct_alloc.c:46)
==7781== by 0x5D3A080: dig_Rd_P_node (plus_struct.c:72)
==7781== by 0x5D3708B: dig_load_plus (plus.c:323)
==7781== by 0x4E4EFC3: Vect_open_topo (open.c:720)
==7781== by 0x4E4DEEB: Vect__open_old (open.c:212)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 519,520 bytes in 6,494 blocks are still reachable in loss record
24 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5D3FF85: dig_alloc_line (struct_alloc.c:112)
==7781== by 0x5D3A447: dig_Rd_P_line (plus_struct.c:177)
==7781== by 0x5D37130: dig_load_plus (plus.c:334)
==7781== by 0x4E4EFC3: Vect_open_topo (open.c:720)
==7781== by 0x4E4DEEB: Vect__open_old (open.c:212)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 614,400 bytes in 1,200 blocks are still reachable in loss record
25 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5F47502: RTreeNewNode (node.c:47)
==7781== by 0x5F46608: RTreeNewIndex (index.c:27)
==7781== by 0x5D3E3B2: dig_spidx_init (spindex.c:38)
==7781== by 0x5D36BA0: dig_init_plus (plus.c:112)
==7781== by 0x5D36FE4: dig_load_plus (plus.c:306)
==7781== by 0x4E4EFC3: Vect_open_topo (open.c:720)
==7781== by 0x4E4DEEB: Vect__open_old (open.c:212)
==7781== by 0x4E4E5D2: Vect_open_old (open.c:385)
==7781== by 0x402EE8: main (main.c:290)
==7781==
==7781==
==7781== 42,133,423 bytes in 1,948,340 blocks are indirectly lost in loss
record 26 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5289AE7: G_malloc (alloc.c:39)
==7781== by 0x52A465E: G_set_key_value (key_value1.c:78)
==7781== by 0x52A4A5F: G_fread_key_value (key_value2.c:45)
==7781== by 0x52A4B7F: G_read_key_value_file (key_value3.c:31)
==7781== by 0x529DAF2: G_get_ellipsoid_parameters (get_ellipse.c:78)
==7781== by 0x52976AD: G_begin_distance_calculations (distance.c:51)
==7781== by 0x4E47687: Vect_line_geodesic_length (line.c:526)
==7781== by 0x403C41: main (main.c:518)
==7781==
==7781==
==7781== 47,984,046 (5,850,623 direct, 42,133,423 indirect) bytes in
243,626 blocks are definitely lost in loss record 27 of 28
==7781== at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5289AE7: G_malloc (alloc.c:39)
==7781== by 0x52A43E9: G_create_key_value (key_value1.c:10)
==7781== by 0x52A49D6: G_fread_key_value (key_value2.c:32)
==7781== by 0x52A4B7F: G_read_key_value_file (key_value3.c:31)
==7781== by 0x529DAF2: G_get_ellipsoid_parameters (get_ellipse.c:78)
==7781== by 0x52976AD: G_begin_distance_calculations (distance.c:51)
==7781== by 0x4E47687: Vect_line_geodesic_length (line.c:526)
==7781== by 0x403C41: main (main.c:518)
==7781==
==7781==
==7781== 11,717,728 bytes in 3 blocks are still reachable in loss record
28 of 28
==7781== at 0x4C1FA97: realloc (in /usr/lib64/valgrind/amd64-
linux/vgpreload_memcheck.so)
==7781== by 0x5289BDA: G_realloc (alloc.c:107)
==7781== by 0x5298613: set_env (env.c:182)
==7781== by 0x529839C: read_env (env.c:126)
==7781== by 0x5298C70: G__getenv (env.c:311)
==7781== by 0x5298B9E: G_getenv (env.c:287)
==7781== by 0x52A69DC: G_location (location.c:71)
==7781== by 0x52A69F3: G__location_path (location.c:81)
==7781== by 0x52A6980: G_location_path (location.c:45)
==7781== by 0x52A1B5F: G_gisinit (gisinit.c:49)
==7781== by 0x402330: main (main.c:106)
==7781==
==7781== LEAK SUMMARY:
==7781== definitely lost: 5,856,767 bytes in 243,638 blocks.
==7781== indirectly lost: 42,133,423 bytes in 1,948,340 blocks.
==7781== possibly lost: 8,616 bytes in 161 blocks.
==7781== still reachable: 13,511,040 bytes in 28,055 blocks.
==7781== suppressed: 0 bytes in 0 blocks.
GRASS 6.3.svn (latlong_sphere):~ >
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/14>
GRASS-trac <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/