[geos-devel] is this a big leak?
strk
strk at keybit.net
Fri Oct 3 17:15:40 EDT 2003
me wrote:
> This is weird. When I run Dave's test I don't get any leaks (at least none are
> detected by my software). What are you using for memory leak detection?
> Valgrind?
> Can you send me the complete leak report that you get?
>
> Yury
> P.S. Oh, and can you send me your parameterized test as well?
Here they are
--strk;
$ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 ./test6
==18711== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==18711== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==18711== Using valgrind-20030725, a program supervision framework for x86-linux.
==18711== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==18711== Estimated CPU clock rate is 1667 MHz
==18711== For more details, rerun with: -v
==18711==
==18711==
==18711== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==18711== malloc/free: in use at exit: 22432 bytes in 22 blocks.
==18711== malloc/free: 773 allocs, 751 frees, 48088 bytes allocated.
==18711== For counts of detected errors, rerun with: -v
==18711== searching for pointers to 22 not-freed blocks.
==18711== checked 4976936 bytes.
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 1 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x4028D697: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_algobase.h:5)
==18711== by 0x4028D6F1: global constructors keyed to geos::CoordinateListFactory::internalFactory (CoordinateListFactory.cpp:290)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 2 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x40294245: __static_initialization_and_destruction_0 (Geometry.cpp:17)
==18711== by 0x402942C9: geos::Geometry::Geometry(void) (Geometry.cpp:445)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 3 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x40294213: __static_initialization_and_destruction_0 (Geometry.cpp:16)
==18711== by 0x402942C9: geos::Geometry::Geometry(void) (Geometry.cpp:445)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 4 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402B1DBB: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_map.h:9)
==18711== by 0x402B1E15: geos::EdgeEnd::EdgeEnd(void) (/usr/include/g++-3/stl_map.h:76)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 5 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402BB00B: __static_initialization_and_destruction_0 (../graph/PlanarGraph.cpp:5)
==18711== by 0x402BB0C5: global constructors keyed to geos::linkResultDirectedEdges(vector<geos::Node *, allocator<geos::Node *> > *) (../graph/PlanarGraph.cpp:14)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 6 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402D506F: __static_initialization_and_destruction_0 (../operation/GeometryGraphOperation.cpp:6)
==18711== by 0x402D5129: geos::GeometryGraphOperation::GeometryGraphOperation(geos::Geometry *, geos::Geometry *) (../operation/GeometryGraphOperation.cpp:15)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 7 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402A84EE: geos::PointLocator::PointLocator(void) (../algorithm/PointLocator.cpp:8)
==18711== by 0x402E2B96: __static_initialization_and_destruction_0 (../operation/relate/RelateComputer.cpp:8)
==18711== by 0x402E2C11: geos::RelateComputer::RelateComputer(void) (../operation/relate/RelateComputer.cpp:13)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 4 bytes in 1 blocks are still reachable in loss record 8 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402E5E6B: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_set.h:9)
==18711== by 0x402E5EC5: global constructors keyed to geos::IsValidOp::findPtNotNode(geos::CoordinateList *, geos::LinearRing *, geos::GeometryGraph *) (/usr/include/g++-3/stl_set.h:61)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 12 bytes in 1 blocks are still reachable in loss record 9 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402E2B8C: __static_initialization_and_destruction_0 (../operation/relate/RelateComputer.cpp:8)
==18711== by 0x402E2C11: geos::RelateComputer::RelateComputer(void) (../operation/relate/RelateComputer.cpp:13)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 28 bytes in 1 blocks are still reachable in loss record 10 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402C25AE: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_algobase.h:7)
==18711== by 0x402C2605: geos::QuadTreeRoot::QuadTreeRoot(void) (../index/quadtree/QuadTreeRoot.cpp:99)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 256 bytes in 1 blocks are still reachable in loss record 11 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402BB040: __static_initialization_and_destruction_0 (../graph/PlanarGraph.cpp:6)
==18711== by 0x402BB0C5: global constructors keyed to geos::linkResultDirectedEdges(vector<geos::Node *, allocator<geos::Node *> > *) (../graph/PlanarGraph.cpp:14)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 256 bytes in 1 blocks are still reachable in loss record 12 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402D50A4: __static_initialization_and_destruction_0 (../operation/GeometryGraphOperation.cpp:7)
==18711== by 0x402D5129: geos::GeometryGraphOperation::GeometryGraphOperation(geos::Geometry *, geos::Geometry *) (../operation/GeometryGraphOperation.cpp:15)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 256 bytes in 1 blocks are still reachable in loss record 13 of 14
==18711== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18711== by 0x402E2B5A: __static_initialization_and_destruction_0 (../operation/relate/RelateComputer.cpp:7)
==18711== by 0x402E2C11: geos::RelateComputer::RelateComputer(void) (../operation/relate/RelateComputer.cpp:13)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711==
==18711== 21592 bytes in 9 blocks are still reachable in loss record 14 of 14
==18711== at 0x4002A9A4: malloc (vg_replace_malloc.c:153)
==18711== by 0x804ABAA: __default_alloc_template<true, 0>::_S_chunk_alloc(unsigned int, int &) (/usr/include/g++-3/stl_alloc.h:490)
==18711== by 0x804A997: __default_alloc_template<true, 0>::_S_refill(unsigned int) (/usr/include/g++-3/stl_alloc.h:531)
==18711== by 0x402F08FB: basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::replace(unsigned int, unsigned int, char const *, unsigned int) (/usr/include/g++-3/stl_alloc.h:332)
==18711== by 0x402E789B: __static_initialization_and_destruction_0 (/usr/include/g++-3/std/bastring.h:223)
==18711== by 0x402E7D3D: geos::TopologyValidationError::TopologyValidationError(int, geos::Coordinate) (/usr/include/g++-3/stl_map.h:76)
==18711== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18711== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18711== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18711==
==18711== LEAK SUMMARY:
==18711== definitely lost: 0 bytes in 0 blocks.
==18711== possibly lost: 0 bytes in 0 blocks.
==18711== still reachable: 22432 bytes in 22 blocks.
==18711== suppressed: 0 bytes in 0 blocks.
==18711==
$ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 ./test6
==18712== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==18712== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==18712== Using valgrind-20030725, a program supervision framework for x86-linux.
==18712== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==18712== Estimated CPU clock rate is 1670 MHz
==18712== For more details, rerun with: -v
==18712==
==18712==
==18712== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==18712== malloc/free: in use at exit: 61360 bytes in 32 blocks.
==18712== malloc/free: 23117 allocs, 23085 frees, 998698 bytes allocated.
==18712== For counts of detected errors, rerun with: -v
==18712== searching for pointers to 32 not-freed blocks.
==18712== checked 5015384 bytes.
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 1 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x4028D697: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_algobase.h:5)
==18712== by 0x4028D6F1: global constructors keyed to geos::CoordinateListFactory::internalFactory (CoordinateListFactory.cpp:290)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 2 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x40294245: __static_initialization_and_destruction_0 (Geometry.cpp:17)
==18712== by 0x402942C9: geos::Geometry::Geometry(void) (Geometry.cpp:445)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 3 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x40294213: __static_initialization_and_destruction_0 (Geometry.cpp:16)
==18712== by 0x402942C9: geos::Geometry::Geometry(void) (Geometry.cpp:445)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 4 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402B1DBB: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_map.h:9)
==18712== by 0x402B1E15: geos::EdgeEnd::EdgeEnd(void) (/usr/include/g++-3/stl_map.h:76)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 5 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402BB00B: __static_initialization_and_destruction_0 (../graph/PlanarGraph.cpp:5)
==18712== by 0x402BB0C5: global constructors keyed to geos::linkResultDirectedEdges(vector<geos::Node *, allocator<geos::Node *> > *) (../graph/PlanarGraph.cpp:14)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 6 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402D506F: __static_initialization_and_destruction_0 (../operation/GeometryGraphOperation.cpp:6)
==18712== by 0x402D5129: geos::GeometryGraphOperation::GeometryGraphOperation(geos::Geometry *, geos::Geometry *) (../operation/GeometryGraphOperation.cpp:15)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 7 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402A84EE: geos::PointLocator::PointLocator(void) (../algorithm/PointLocator.cpp:8)
==18712== by 0x402E2B96: __static_initialization_and_destruction_0 (../operation/relate/RelateComputer.cpp:8)
==18712== by 0x402E2C11: geos::RelateComputer::RelateComputer(void) (../operation/relate/RelateComputer.cpp:13)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 4 bytes in 1 blocks are still reachable in loss record 8 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402E5E6B: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_set.h:9)
==18712== by 0x402E5EC5: global constructors keyed to geos::IsValidOp::findPtNotNode(geos::CoordinateList *, geos::LinearRing *, geos::GeometryGraph *) (/usr/include/g++-3/stl_set.h:61)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 12 bytes in 1 blocks are still reachable in loss record 9 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402E2B8C: __static_initialization_and_destruction_0 (../operation/relate/RelateComputer.cpp:8)
==18712== by 0x402E2C11: geos::RelateComputer::RelateComputer(void) (../operation/relate/RelateComputer.cpp:13)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 28 bytes in 1 blocks are still reachable in loss record 10 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402C25AE: __static_initialization_and_destruction_0 (/usr/include/g++-3/stl_algobase.h:7)
==18712== by 0x402C2605: geos::QuadTreeRoot::QuadTreeRoot(void) (../index/quadtree/QuadTreeRoot.cpp:99)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 256 bytes in 1 blocks are still reachable in loss record 11 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402BB040: __static_initialization_and_destruction_0 (../graph/PlanarGraph.cpp:6)
==18712== by 0x402BB0C5: global constructors keyed to geos::linkResultDirectedEdges(vector<geos::Node *, allocator<geos::Node *> > *) (../graph/PlanarGraph.cpp:14)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 256 bytes in 1 blocks are still reachable in loss record 12 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402D50A4: __static_initialization_and_destruction_0 (../operation/GeometryGraphOperation.cpp:7)
==18712== by 0x402D5129: geos::GeometryGraphOperation::GeometryGraphOperation(geos::Geometry *, geos::Geometry *) (../operation/GeometryGraphOperation.cpp:15)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 256 bytes in 1 blocks are still reachable in loss record 13 of 14
==18712== at 0x4002AA98: __builtin_new (vg_replace_malloc.c:172)
==18712== by 0x402E2B5A: __static_initialization_and_destruction_0 (../operation/relate/RelateComputer.cpp:7)
==18712== by 0x402E2C11: geos::RelateComputer::RelateComputer(void) (../operation/relate/RelateComputer.cpp:13)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712==
==18712== 60520 bytes in 19 blocks are still reachable in loss record 14 of 14
==18712== at 0x4002A9A4: malloc (vg_replace_malloc.c:153)
==18712== by 0x804ABAA: __default_alloc_template<true, 0>::_S_chunk_alloc(unsigned int, int &) (/usr/include/g++-3/stl_alloc.h:490)
==18712== by 0x804A997: __default_alloc_template<true, 0>::_S_refill(unsigned int) (/usr/include/g++-3/stl_alloc.h:531)
==18712== by 0x402F08FB: basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::replace(unsigned int, unsigned int, char const *, unsigned int) (/usr/include/g++-3/stl_alloc.h:332)
==18712== by 0x402E789B: __static_initialization_and_destruction_0 (/usr/include/g++-3/std/bastring.h:223)
==18712== by 0x402E7D3D: geos::TopologyValidationError::TopologyValidationError(int, geos::Coordinate) (/usr/include/g++-3/stl_map.h:76)
==18712== by 0x402EFAD4: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4028682D: (within /extra/geos/lib/libgeos.so.1.0.0)
==18712== by 0x4000D1D8: _dl_init (dl-init.c:70)
==18712== by 0x40001DB0: (within /lib/ld-2.2.2.so)
==18712==
==18712== LEAK SUMMARY:
==18712== definitely lost: 0 bytes in 0 blocks.
==18712== possibly lost: 0 bytes in 0 blocks.
==18712== still reachable: 61360 bytes in 32 blocks.
==18712== suppressed: 0 bytes in 0 blocks.
==18712==
$ cat test6.cpp
// g++ -g -o test6 test6.cpp -I/usr/local/include/geos -lgeos
// valgrind --leak-check=yes --num-callers=10 ./test6 <iterations> <offset>
#include "stdio.h"
#include "io.h"
#include "geom.h"
using namespace geos;
double global_offset = 0;
//create a simple multi-polygon
// offset shift the polygon to the left <offset> units
// MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 10.0000000000000000 0.0000000000000000, 10.0000000000000000 10.0000000000000000, 0.0000000000000000 10.0000000000000000, 0.0000000000000000 0.0000000000000000), (2.0000000000000000 2.0000000000000000, 4.0000000000000000 2.0000000000000000, 4.0000000000000000 4.0000000000000000, 2.0000000000000000 4.0000000000000000, 2.0000000000000000 2.0000000000000000)))
Geometry *a(double offset, GeometryFactory *geomFactory)
{
Geometry *g1, *g2 ;
Coordinate *c;
CoordinateList *cl;
LinearRing *outerRing;
vector<Geometry *> *innerRings=new vector<Geometry *>;
LinearRing *innerRing;
vector<Geometry *> *polys=new vector<Geometry *>;
cl = new BasicCoordinateList(5);
c = new Coordinate(0+offset, 0);
cl->setAt( *c ,0);
delete c;
c = new Coordinate(10+offset, 0);
cl->setAt( *c ,1);
delete c;
c = new Coordinate(10+offset, 10);
cl->setAt( *c ,2);
delete c;
c = new Coordinate(0+offset, 10);
cl->setAt( *c ,3);
delete c;
c = new Coordinate(0+offset, 0);
cl->setAt( *c ,4);
delete c;
outerRing = (LinearRing*) geomFactory->createLinearRing(cl);
cl = new BasicCoordinateList(5);
c = new Coordinate(2+offset, 2);
cl->setAt( *c ,0);
delete c;
c = new Coordinate(4+offset, 2);
cl->setAt( *c ,1);
delete c;
c = new Coordinate(4+offset, 4);
cl->setAt( *c ,2);
delete c;
c = new Coordinate(2+offset, 4);
cl->setAt( *c ,3);
delete c;
c = new Coordinate(2+offset, 2);
cl->setAt( *c ,4);
delete c;
innerRing = (LinearRing *) geomFactory->createLinearRing(cl);
innerRings->push_back(innerRing);
g1 = geomFactory->createPolygon(outerRing, innerRings);
polys->push_back(g1);
g2 = geomFactory->createMultiPolygon(polys);
return g2;
}
//unions
// aa AND
// a new geometry, which is the standard multipolygon translated to the right
Geometry *op(Geometry *aa, int offset, GeometryFactory *gf)
{
Geometry *bb, *cc;
bb = a(global_offset, gf);
//15 ==> leaks a lot
//5 ==> leaks a constant amount
global_offset += offset;
try {
cc = aa->Union(bb);
}
catch (...)
{
cerr << "Exception trhown by Union"<<endl;
}
delete aa;
delete bb;
return cc;
}
int main(int argC, char* argV[])
{
PrecisionModel *pm= new PrecisionModel();
GeometryFactory *gf = new GeometryFactory( pm, -1);
Geometry *aa, *bb;
int i;
int numiterations = 5;
int offset = 15;
if ( argC > 1 ) numiterations = atoi(argV[1]);
if ( argC > 2 ) offset = atoi(argV[2]);
aa = a(offset, gf);
for (i=0; i<numiterations; i++)
{
aa = op(aa, offset, gf);
}
//string s= aa->toString();
//cout << s << endl;
delete aa;
delete gf;
delete pm;
}
More information about the geos-devel
mailing list