Opened 17 years ago

Closed 10 years ago

#14 closed defect (wontfix)

libgis and libvect memory leaks

Reported by: neteler Owned by: grass-dev@…
Priority: major Milestone: 6.4.2
Component: LibVector Version: svn-releasebranch64
Keywords: library Cc: neteler
CPU: x86-64 Platform: Linux

Description

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):~ > 

Change History (7)

comment:1 by martinl, 17 years ago

Cc: neteler@… added
Keywords: library added
Owner: changed from grass-dev@… to martinl

Now fixed in trunk, [29640]

Martin

comment:2 by neteler, 17 years ago

Summary: v.distance: memory leak in LatLong?libgis and libvect memory leaks

This helped, thanks for the fix. But I still observe memory leaks:

...

==10880== 16,294 bytes in 125 blocks are still reachable in loss record 19 of 24
==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==10880==    by 0x5289AE7: G_malloc (alloc.c:39)
==10880==    by 0x52C3229: G_store (store.c:36)
==10880==    by 0x52B5B55: G_set_program_name (progrm_nme.c:53)
==10880==    by 0x52A1AC6: G_gisinit (gisinit.c:46)
==10880==    by 0x402370: main (main.c:106)
==10880==
==10880==
==10880== 40,064 bytes in 2,010 blocks are still reachable in loss record 20 of 24
==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==10880==    by 0x4C1FA10: realloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==10880==    by 0x5D3FF34: dig_alloc_nodes (struct_alloc.c:98)
==10880==    by 0x5D37072: dig_load_plus (plus.c:320)
==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
==10880==    by 0x402F28: main (main.c:290)
==10880==
==10880==
==10880== 48,000 bytes in 1,000 blocks are still reachable in loss record 21 of 24
==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==10880==    by 0x5D3FDE5: dig_alloc_node (struct_alloc.c:46)
==10880==    by 0x5D3A080: dig_Rd_P_node (plus_struct.c:72)
==10880==    by 0x5D3708B: dig_load_plus (plus.c:323)
==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
==10880==    by 0x402F28: main (main.c:290)
==10880==
==10880==
==10880== 80,000 bytes in 1,000 blocks are still reachable in loss record 22 of 24
==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==10880==    by 0x5D3FF85: dig_alloc_line (struct_alloc.c:112)
==10880==    by 0x5D3A447: dig_Rd_P_line (plus_struct.c:177)
==10880==    by 0x5D37130: dig_load_plus (plus.c:334)
==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
==10880==    by 0x402F28: main (main.c:290)
==10880==
==10880==
==10880== 99,328 bytes in 194 blocks are still reachable in loss record 23 of 24
==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==10880==    by 0x5F47502: RTreeNewNode (node.c:47)
==10880==    by 0x5F46608: RTreeNewIndex (index.c:27)
==10880==    by 0x5D3E3B2: dig_spidx_init (spindex.c:38)
==10880==    by 0x5D36BA0: dig_init_plus (plus.c:112)
==10880==    by 0x5D36FE4: dig_load_plus (plus.c:306)
==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
==10880==    by 0x402F28: main (main.c:290)
==10880==
==10880==
==10880== 4,306,696 bytes in 3 blocks are still reachable in loss record 24 of 24
==10880==    at 0x4C1FA97: realloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==10880==    by 0x5289BDA: G_realloc (alloc.c:107)
==10880==    by 0x5298613: set_env (env.c:182)
==10880==    by 0x529839C: read_env (env.c:126)
==10880==    by 0x5298C70: G__getenv (env.c:311)
==10880==    by 0x5298B9E: G_getenv (env.c:287)
==10880==    by 0x52A6948: G_location (location.c:71)
==10880==    by 0x52A695F: G__location_path (location.c:81)
==10880==    by 0x52A68EC: G_location_path (location.c:45)
==10880==    by 0x52A1ACB: G_gisinit (gisinit.c:49)
==10880==    by 0x402370: main (main.c:106)

...

which possibly slow down several commands.

Markus

in reply to:  2 comment:3 by martinl, 17 years ago

Cc: neteler added; neteler@… removed

Replying to neteler:

This helped, thanks for the fix. But I still observe memory leaks:

...

> ==10880== 16,294 bytes in 125 blocks are still reachable in loss record 19 of 24
> ==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==10880==    by 0x5289AE7: G_malloc (alloc.c:39)
> ==10880==    by 0x52C3229: G_store (store.c:36)
> ==10880==    by 0x52B5B55: G_set_program_name (progrm_nme.c:53)
> ==10880==    by 0x52A1AC6: G_gisinit (gisinit.c:46)
> ==10880==    by 0x402370: main (main.c:106)
> ==10880==
> ==10880==
> ==10880== 40,064 bytes in 2,010 blocks are still reachable in loss record 20 of 24
> ==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==10880==    by 0x4C1FA10: realloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==10880==    by 0x5D3FF34: dig_alloc_nodes (struct_alloc.c:98)
> ==10880==    by 0x5D37072: dig_load_plus (plus.c:320)
> ==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
> ==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
> ==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
> ==10880==    by 0x402F28: main (main.c:290)
> ==10880==
> ==10880==
> ==10880== 48,000 bytes in 1,000 blocks are still reachable in loss record 21 of 24
> ==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==10880==    by 0x5D3FDE5: dig_alloc_node (struct_alloc.c:46)
> ==10880==    by 0x5D3A080: dig_Rd_P_node (plus_struct.c:72)
> ==10880==    by 0x5D3708B: dig_load_plus (plus.c:323)
> ==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
> ==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
> ==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
> ==10880==    by 0x402F28: main (main.c:290)
> ==10880==
> ==10880==
> ==10880== 80,000 bytes in 1,000 blocks are still reachable in loss record 22 of 24
> ==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==10880==    by 0x5D3FF85: dig_alloc_line (struct_alloc.c:112)
> ==10880==    by 0x5D3A447: dig_Rd_P_line (plus_struct.c:177)
> ==10880==    by 0x5D37130: dig_load_plus (plus.c:334)
> ==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
> ==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
> ==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
> ==10880==    by 0x402F28: main (main.c:290)
> ==10880==
> ==10880==
> ==10880== 99,328 bytes in 194 blocks are still reachable in loss record 23 of 24
> ==10880==    at 0x4C1F996: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==10880==    by 0x5F47502: RTreeNewNode (node.c:47)
> ==10880==    by 0x5F46608: RTreeNewIndex (index.c:27)
> ==10880==    by 0x5D3E3B2: dig_spidx_init (spindex.c:38)
> ==10880==    by 0x5D36BA0: dig_init_plus (plus.c:112)
> ==10880==    by 0x5D36FE4: dig_load_plus (plus.c:306)
> ==10880==    by 0x4E4EFC3: Vect_open_topo (open.c:720)
> ==10880==    by 0x4E4DEEB: Vect__open_old (open.c:212)
> ==10880==    by 0x4E4E5D2: Vect_open_old (open.c:385)
> ==10880==    by 0x402F28: main (main.c:290)
> ==10880==
> ==10880==
> ==10880== 4,306,696 bytes in 3 blocks are still reachable in loss record 24 of 24
> ==10880==    at 0x4C1FA97: realloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==10880==    by 0x5289BDA: G_realloc (alloc.c:107)
> ==10880==    by 0x5298613: set_env (env.c:182)
> ==10880==    by 0x529839C: read_env (env.c:126)
> ==10880==    by 0x5298C70: G__getenv (env.c:311)
> ==10880==    by 0x5298B9E: G_getenv (env.c:287)
> ==10880==    by 0x52A6948: G_location (location.c:71)
> ==10880==    by 0x52A695F: G__location_path (location.c:81)
> ==10880==    by 0x52A68EC: G_location_path (location.c:45)
> ==10880==    by 0x52A1ACB: G_gisinit (gisinit.c:49)
> ==10880==    by 0x402370: main (main.c:106)

...

which possibly slow down several commands.

... back to v.distance

1) v.distance -ap from=busstopsall to=busroutesall upload=dist col=dist

==12838== 1,088,056 bytes in 3 blocks are still reachable in loss record 18 of 18
==12838==    at 0x4024B8E: realloc (vg_replace_malloc.c:429)
==12838==    by 0x408113E: G_realloc (alloc.c:107)
==12838==    by 0x408EF6C: set_env (env.c:162)
==12838==    by 0x408ED29: read_env (env.c:106)
==12838==    by 0x408F56A: G__getenv (env.c:322)
==12838==    by 0x408F479: G_getenv (env.c:276)
==12838==    by 0x409C494: G_location (location.c:66)
==12838==    by 0x409C4B9: G__location_path (location.c:82)
==12838==    by 0x409C41A: G_location_path (location.c:42)
==12838==    by 0x40979E3: G_gisinit (gisinit.c:49)
==12838==    by 0x8049D40: main (main.c:107)
==12838== 
==12838== LEAK SUMMARY:
==12838==    definitely lost: 9,297 bytes in 38 blocks.
==12838==    indirectly lost: 120 bytes in 10 blocks.
==12838==      possibly lost: 0 bytes in 0 blocks.
==12838==    still reachable: 1,187,006 bytes in 1,260 blocks.
==12838==         suppressed: 0 bytes in 0 blocks.

2) v.distance -p from=busstopsall to=busroutesall upload=dist col=dist

==12853== 24,752 bytes in 52 blocks are still reachable in loss record 18 of 18
==12853==    at 0x4024AB8: malloc (vg_replace_malloc.c:207)
==12853==    by 0x413A029: RTreeNewNode (node.c:47)
==12853==    by 0x413920E: RTreeNewIndex (index.c:27)
==12853==    by 0x41320A4: dig_spidx_init (spindex.c:38)
==12853==    by 0x412A86C: dig_init_plus (plus.c:112)
==12853==    by 0x412ACB2: dig_load_plus (plus.c:306)
==12853==    by 0x404F1F1: Vect_open_topo (open.c:702)
==12853==    by 0x404E144: Vect__open_old (open.c:210)
==12853==    by 0x404E7F6: Vect_open_old (open.c:381)
==12853==    by 0x804A8AA: main (main.c:291)
==12853== 
==12853== LEAK SUMMARY:
==12853==    definitely lost: 9,297 bytes in 38 blocks.
==12853==    indirectly lost: 120 bytes in 10 blocks.
==12853==      possibly lost: 0 bytes in 0 blocks.
==12853==    still reachable: 111,618 bytes in 1,260 blocks.
==12853==         suppressed: 0 bytes in 0 blocks.

Strange, confused why -a flag makes difference in this case.

Martin

comment:4 by martinl, 17 years ago

Owner: changed from martinl to grass-dev@…

comment:5 by martinl, 17 years ago

Milestone: 6.3.06.4.0

comment:6 by neteler, 13 years ago

CPU: x86-64
Milestone: 6.4.06.4.2
Platform: Linux

I have tried again in 6.4.svn and latlong location:

GRASS 6.4.2svn (latlong): > v.random -z random n=50 zmin=0 zmax=1000  --o
...
GRASS 6.4.2svn (latlong): > CMD="v.distance -p -a random to=random upload=dist col=distance"
GRASS 6.4.2svn (latlong): > valgrind --tool=memcheck --leak-check=yes --show-reachable=yes  $CMD --o
==29334== Memcheck, a memory error detector
==29334== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==29334== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==29334== Command: v.distance -p -a random to=random upload=dist col=distance --o
==29334== 
 100%
 100%
 100%
from_cat|distance
 |1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50
1|0.000000|...|32734.380864|23046.856804
==29334== Conditional jump or move depends on uninitialised value(s)
==29334==    at 0x405233: main (main.c:880)
==29334== 
==29334== Conditional jump or move depends on uninitialised value(s)
==29334==    at 0x40525B: main (main.c:882)
==29334== 
==29334== Conditional jump or move depends on uninitialised value(s)
==29334==    at 0x406444: print_upload (main.c:1209)
==29334==    by 0x405444: main (main.c:908)
==29334== 
3|12556.339237|25370.513554|0.000000|26554.768615|20852.698295|25627.160524|31327.845332|44054.011005|12806.274846|31899.906958|45010.468266|33262.426524|37211.815414|24066.675903|26842.672920|2...
|17314.385880|39790.227209|0.000000
414 categories with more than 1 feature in vector map <random>
v.distance complete.
==29334== 
==29334== HEAP SUMMARY:
==29334==     in use at exit: 300,551 bytes in 714 blocks
==29334==   total heap usage: 96,312 allocs, 95,598 frees, 24,523,587 bytes allocated
==29334== 
==29334== 1 bytes in 1 blocks are still reachable in loss record 1 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x52D6DB7: G_store (store.c:36)
==29334==    by 0x4E4EEA3: Vect_set_organization (header.c:258)
==29334==    by 0x4E4EAAC: Vect__read_head (header.c:160)
==29334==    by 0x4E5CB8D: Vect__open_old (open.c:209)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403018: main (main.c:306)
==29334== 
==29334== 1 bytes in 1 blocks are still reachable in loss record 2 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x52D6DB7: G_store (store.c:36)
==29334==    by 0x4E4EEF9: Vect_set_date (header.c:289)
==29334==    by 0x4E4EAE6: Vect__read_head (header.c:162)
==29334==    by 0x4E5CB8D: Vect__open_old (open.c:209)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403018: main (main.c:306)
==29334== 
==29334== 1 bytes in 1 blocks are still reachable in loss record 3 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x52D6DB7: G_store (store.c:36)
==29334==    by 0x4E4EFA5: Vect_set_map_name (header.c:346)
==29334==    by 0x4E4EB5A: Vect__read_head (header.c:166)
==29334==    by 0x4E5CB8D: Vect__open_old (open.c:209)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403018: main (main.c:306)
==29334== 
==29334== 1 bytes in 1 blocks are still reachable in loss record 4 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x52D6DB7: G_store (store.c:36)
==29334==    by 0x4E4F089: Vect_set_comment (header.c:426)
==29334==    by 0x4E4EC11: Vect__read_head (header.c:172)
==29334==    by 0x4E5CB8D: Vect__open_old (open.c:209)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403018: main (main.c:306)
==29334== 
... [tons of tiny things omitted]

==29334== 
==29334== 136 bytes in 3 blocks are still reachable in loss record 73 of 150
==29334==    at 0x4C235C7: calloc (vg_replace_malloc.c:418)
==29334==    by 0x529D1EF: G__calloc (alloc.c:74)
==29334==    by 0x52C1BEF: G_parser (parser.c:784)
==29334==    by 0x402957: main (main.c:227)
==29334== 

...

==29334== 568 bytes in 1 blocks are still reachable in loss record 136 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x6FE1544: fdopen@@GLIBC_2.2.5 (in /lib64/libc-2.11.1.so)
==29334==    by 0x52BE0EA: G_fopen_old (open.c:234)
==29334==    by 0x4E5D20B: Vect__open_old (open.c:366)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403065: main (main.c:311)
==29334== 
==29334== 600 bytes in 1 blocks are still reachable in loss record 137 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x5D45DFF: dig_read_cidx (cindex_rw.c:281)
==29334==    by 0x4E4567D: Vect_cidx_open (cindex.c:518)
==29334==    by 0x4E5CCD7: Vect__open_old (open.c:252)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403018: main (main.c:306)
==29334== 
==29334== 600 bytes in 1 blocks are still reachable in loss record 138 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x5D45DFF: dig_read_cidx (cindex_rw.c:281)
==29334==    by 0x4E4567D: Vect_cidx_open (cindex.c:518)
==29334==    by 0x4E5CCD7: Vect__open_old (open.c:252)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403065: main (main.c:311)
==29334== 
==29334== 800 bytes in 10 blocks are still reachable in loss record 139 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x52C6E4C: split_opts (parser.c:2472)
==29334==    by 0x52C246B: G_parser (parser.c:978)
==29334==    by 0x402957: main (main.c:227)
==29334== 
==29334== 952 bytes in 54 blocks are still reachable in loss record 140 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x52D6DB7: G_store (store.c:36)
==29334==    by 0x52B2412: read_ellipsoid_table (get_ellipse.c:309)
==29334==    by 0x52B1C43: G_get_ellipsoid_by_name (get_ellipse.c:114)
==29334==    by 0x52B27B4: get_ellipsoid_parameters (get_ellipse.c:370)
==29334==    by 0x52B1C09: G_get_ellipsoid_parameters (get_ellipse.c:89)
==29334==    by 0x52AB985: G_begin_distance_calculations (distance.c:51)
==29334==    by 0x4E56048: Vect_line_geodesic_length (line.c:585)
==29334==    by 0x403DBF: main (main.c:562)
==29334== 
==29334== 2,160 bytes in 1 blocks are still reachable in loss record 141 of 150
==29334==    at 0x4C2439D: realloc (vg_replace_malloc.c:476)
==29334==    by 0x529D28D: G__realloc (alloc.c:111)
==29334==    by 0x52B23A6: read_ellipsoid_table (get_ellipse.c:306)
==29334==    by 0x52B1C43: G_get_ellipsoid_by_name (get_ellipse.c:114)
==29334==    by 0x52B27B4: get_ellipsoid_parameters (get_ellipse.c:370)
==29334==    by 0x52B1C09: G_get_ellipsoid_parameters (get_ellipse.c:89)
==29334==    by 0x52AB985: G_begin_distance_calculations (distance.c:51)
==29334==    by 0x4E56048: Vect_line_geodesic_length (line.c:585)
==29334==    by 0x403DBF: main (main.c:562)
==29334== 
==29334== 2,400 bytes in 50 blocks are still reachable in loss record 142 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x5D512F1: dig_alloc_node (struct_alloc.c:44)
==29334==    by 0x5D4B183: dig_Rd_P_node (plus_struct.c:66)
==29334==    by 0x5D4821B: dig_load_plus (plus.c:292)
==29334==    by 0x4E5DF39: Vect_open_topo (open.c:751)
==29334==    by 0x4E5CC41: Vect__open_old (open.c:229)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403018: main (main.c:306)
==29334== 
==29334== 2,400 bytes in 50 blocks are still reachable in loss record 143 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x5D512F1: dig_alloc_node (struct_alloc.c:44)
==29334==    by 0x5D4B183: dig_Rd_P_node (plus_struct.c:66)
==29334==    by 0x5D4821B: dig_load_plus (plus.c:292)
==29334==    by 0x4E5DF39: Vect_open_topo (open.c:751)
==29334==    by 0x4E5CC41: Vect__open_old (open.c:229)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403065: main (main.c:311)
==29334== 
==29334== 3,584 bytes in 7 blocks are still reachable in loss record 144 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x5F59525: RTreeNewNode (node.c:49)
==29334==    by 0x5F5B921: RTreeSplitNode (split_q.c:313)
==29334==    by 0x5F59D07: RTreeAddBranch (node.c:201)
==29334==    by 0x5F58B9E: RTreeInsertRect2 (index.c:121)
==29334==    by 0x5F58982: RTreeInsertRect2 (index.c:102)
==29334==    by 0x5F58D3F: RTreeInsertRect1 (index.c:162)
==29334==    by 0x5F58C25: RTreeInsertRect (index.c:141)
==29334==    by 0x5D4F929: dig_spidx_add_node (spindex.c:134)
==29334==    by 0x4E64160: Vect_build_sidx_from_topo (sindex.c:170)
==29334==    by 0x4E634C7: Vect_select_lines_by_box (select.c:53)
==29334==    by 0x403B95: main (main.c:534)
==29334== 
==29334== 3,584 bytes in 7 blocks are still reachable in loss record 145 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x5F59525: RTreeNewNode (node.c:49)
==29334==    by 0x5F5B921: RTreeSplitNode (split_q.c:313)
==29334==    by 0x5F59D07: RTreeAddBranch (node.c:201)
==29334==    by 0x5F58B9E: RTreeInsertRect2 (index.c:121)
==29334==    by 0x5F58982: RTreeInsertRect2 (index.c:102)
==29334==    by 0x5F58D3F: RTreeInsertRect1 (index.c:162)
==29334==    by 0x5F58C25: RTreeInsertRect (index.c:141)
==29334==    by 0x5D4F9CC: dig_spidx_add_line (spindex.c:160)
==29334==    by 0x4E64254: Vect_build_sidx_from_topo (sindex.c:189)
==29334==    by 0x4E634C7: Vect_select_lines_by_box (select.c:53)
==29334==    by 0x403B95: main (main.c:534)
==29334== 
==29334== 4,000 bytes in 1 blocks are still reachable in loss record 146 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D274: G__realloc (alloc.c:109)
==29334==    by 0x5D47974: dig_list_add (list.c:40)
==29334==    by 0x5D4FF50: _add_item (spindex.c:370)
==29334==    by 0x5F5885A: RTreeSearch (index.c:65)
==29334==    by 0x5F587A3: RTreeSearch (index.c:56)
==29334==    by 0x5D50168: dig_select_lines (spindex.c:467)
==29334==    by 0x4E63504: Vect_select_lines_by_box (select.c:60)
==29334==    by 0x403B95: main (main.c:534)
==29334== 
==29334== 4,000 bytes in 1 blocks are still reachable in loss record 147 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D274: G__realloc (alloc.c:109)
==29334==    by 0x5D47974: dig_list_add (list.c:40)
==29334==    by 0x4E635A8: Vect_select_lines_by_box (select.c:71)
==29334==    by 0x403B95: main (main.c:534)
==29334== 
==29334== 4,000 bytes in 50 blocks are still reachable in loss record 148 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x5D514BA: dig_alloc_line (struct_alloc.c:114)
==29334==    by 0x5D4B56A: dig_Rd_P_line (plus_struct.c:166)
==29334==    by 0x5D482D2: dig_load_plus (plus.c:302)
==29334==    by 0x4E5DF39: Vect_open_topo (open.c:751)
==29334==    by 0x4E5CC41: Vect__open_old (open.c:229)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403018: main (main.c:306)
==29334== 
==29334== 4,000 bytes in 50 blocks are still reachable in loss record 149 of 150
==29334==    at 0x4C242A3: malloc (vg_replace_malloc.c:195)
==29334==    by 0x529D162: G__malloc (alloc.c:41)
==29334==    by 0x5D514BA: dig_alloc_line (struct_alloc.c:114)
==29334==    by 0x5D4B56A: dig_Rd_P_line (plus_struct.c:166)
==29334==    by 0x5D482D2: dig_load_plus (plus.c:302)
==29334==    by 0x4E5DF39: Vect_open_topo (open.c:751)
==29334==    by 0x4E5CC41: Vect__open_old (open.c:229)
==29334==    by 0x4E5D3D9: Vect_open_old (open.c:415)
==29334==    by 0x403065: main (main.c:311)
==29334== 
==29334== 240,000 bytes in 1 blocks are still reachable in loss record 150 of 150
==29334==    at 0x4C2439D: realloc (vg_replace_malloc.c:476)
==29334==    by 0x529D28D: G__realloc (alloc.c:111)
==29334==    by 0x403F2E: main (main.c:577)
==29334== 
==29334== LEAK SUMMARY:
==29334==    definitely lost: 10,048 bytes in 25 blocks
==29334==    indirectly lost: 0 bytes in 0 blocks
==29334==      possibly lost: 0 bytes in 0 blocks
==29334==    still reachable: 290,503 bytes in 689 blocks
==29334==         suppressed: 0 bytes in 0 blocks
==29334== 
==29334== For counts of detected and suppressed errors, rerun with: -v
==29334== Use --track-origins=yes to see where uninitialised values come from
==29334== ERROR SUMMARY: 7225 errors from 28 contexts (suppressed: 4 from 4)

With 300 random points it consumes more than 4GB RAM and needed to be killed then.

comment:7 by neteler, 10 years ago

Component: DefaultLibVector
Resolution: wontfix
Status: newclosed
Version: svn-trunksvn-releasebranch64

Tested in G7 relbranch/r63512 and memory consumption is much lower than in G6.4.svn (as expected).

Test case G6:

export GRASS_OVERWRITE=1
v.random -z random n=50 zmin=0 zmax=1000
CMD="v.distance -p -a random to=random upload=dist column=dummy"
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes $CMD

Test case G7:

export GRASS_OVERWRITE=1
v.random -z random n=50 zmin=0 zmax=1000
CMD="v.distance -p -a random to=random upload=dist"
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes $CMD

Given the massive rewrite of the vector engine in G7, I'll close this as wontfix for G6.

Note: See TracTickets for help on using tickets.