#1010: Leak in GEOSLineMerge_r ------------------------+-------------------------- Reporter: Algunenano | Owner: geos-devel@… Type: defect | Status: new Priority: major | Milestone: 3.9.0 Component: Default | Version: master Severity: Unassigned | Keywords: ------------------------+-------------------------- From Postgis tests with HEAD: {{{ $ valgrind --leak-check=full --show-leak-kinds=all ./cunit/cu_tester test_geos_linemerge
==548693== 40 bytes in 1 blocks are indirectly lost in loss record 2 of 6 ==548693== at 0x4838DEF: operator new(unsigned long) (vg_replace_malloc.c:344) ==548693== by 0x5C8C098: geos::operation::linemerge::EdgeString::getCoordinates() (EdgeString.cpp:66) ==548693== by 0x5C8C1FD: geos::operation::linemerge::EdgeString::toLineString() (EdgeString.cpp:96) ==548693== by 0x5C8D4CE: geos::operation::linemerge::LineMerger::merge() (LineMerger.cpp:130) ==548693== by 0x5C8DADD: geos::operation::linemerge::LineMerger::getMergedLineStrings() (LineMerger.cpp:233) ==548693== by 0x4BF67CA: operator() (geos_ts_c.cpp:1896) ==548693== by 0x4BF67CA: execute<(lambda at geos_ts_c.cpp:1890:35), nullptr> (geos_ts_c.cpp:377) ==548693== by 0x4BF67CA: GEOSLineMerge_r (geos_ts_c.cpp:1890) ==548693== by 0x1AB257: lwgeom_linemerge (lwgeom_geos.c:727) ==548693== by 0x125E18: test_geos_linemerge (cu_geos.c:89) ==548693== by 0x4884117: ??? (in /usr/lib/libcunit.so.1.0.1) ==548693== by 0x4884AAF: CU_run_test (in /usr/lib/libcunit.so.1.0.1) ==548693== by 0x158A12: main (cu_tester.c:226) ==548693== ==548693== 96 bytes in 1 blocks are indirectly lost in loss record 3 of 6 ==548693== at 0x4838DEF: operator new(unsigned long) (vg_replace_malloc.c:344) ==548693== by 0x5C184A1: allocate (new_allocator.h:114) ==548693== by 0x5C184A1: allocate (alloc_traits.h:444) ==548693== by 0x5C184A1: _M_allocate (stl_vector.h:343) ==548693== by 0x5C184A1: _M_realloc_insert<const geos::geom::Coordinate &> (vector.tcc:440) ==548693== by 0x5C184A1: push_back (stl_vector.h:1195) ==548693== by 0x5C184A1: geos::geom::CoordinateArraySequence::add(geos::geom::Coordinate const&, bool) (CoordinateArraySequence.cpp:135) ==548693== by 0x5C185F9: geos::geom::CoordinateArraySequence::add(geos::geom::CoordinateSequence const*, bool, bool) (CoordinateArraySequence.cpp:146) ==548693== by 0x5C8C15D: geos::operation::linemerge::EdgeString::getCoordinates() (EdgeString.cpp:79) ==548693== by 0x5C8C1FD: geos::operation::linemerge::EdgeString::toLineString() (EdgeString.cpp:96) ==548693== by 0x5C8D4CE: geos::operation::linemerge::LineMerger::merge() (LineMerger.cpp:130) ==548693== by 0x5C8DADD: geos::operation::linemerge::LineMerger::getMergedLineStrings() (LineMerger.cpp:233) ==548693== by 0x4BF67CA: operator() (geos_ts_c.cpp:1896) ==548693== by 0x4BF67CA: execute<(lambda at geos_ts_c.cpp:1890:35), nullptr> (geos_ts_c.cpp:377) ==548693== by 0x4BF67CA: GEOSLineMerge_r (geos_ts_c.cpp:1890) ==548693== by 0x1AB257: lwgeom_linemerge (lwgeom_geos.c:727) ==548693== by 0x125E18: test_geos_linemerge (cu_geos.c:89) ==548693== by 0x4884117: ??? (in /usr/lib/libcunit.so.1.0.1) ==548693== by 0x4884AAF: CU_run_test (in /usr/lib/libcunit.so.1.0.1) }}} The bisection points to https://github.com/libgeos/geos/commit/7a7cbf84fc5d4369baaf4c6e0614f44d4207503f as the culprit. I've tried to readd the removed `delete` call but it doesn't fix it: - delete didn't fix it: https://github.com/Algunenano/geos/commit/f40a4eb8 - unique_ptr didn't fix it: https://github.com/Algunenano/geos/commit/3e5f8c59 - full revert does fix it: https://github.com/Algunenano/geos/commit/0e40b08a I'm not sure what is causing the leak in the changes, so I'm not opening a PR yet, but feel free to fix it if you see what the issue is. -- Ticket URL: <https://trac.osgeo.org/geos/ticket/1010> GEOS <http://trac.osgeo.org/geos> GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).
_______________________________________________ geos-devel mailing list geos-devel@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/geos-devel