[geos-devel] [GEOS] #923: Memory leak in GEOSNode
GEOS
geos-trac at osgeo.org
Thu Sep 20 09:34:49 PDT 2018
#923: Memory leak in GEOSNode
-------------------------+---------------------------
Reporter: Algunenano | Owner: geos-devel@…
Type: defect | Status: new
Priority: major | Milestone: 3.8.0
Component: Default | Version: master
Severity: Significant | Resolution:
Keywords: |
-------------------------+---------------------------
Comment (by Algunenano):
Adding finishGeos() to the script:
3.7.0:
{{{
==5574== Memcheck, a memory error detector
==5574== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==5574== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright
info
==5574== Command: ./a.out
==5574==
==5574==
==5574== HEAP SUMMARY:
==5574== in use at exit: 56 bytes in 2 blocks
==5574== total heap usage: 65 allocs, 63 frees, 81,848 bytes allocated
==5574==
==5574== LEAK SUMMARY:
==5574== definitely lost: 0 bytes in 0 blocks
==5574== indirectly lost: 0 bytes in 0 blocks
==5574== possibly lost: 0 bytes in 0 blocks
==5574== still reachable: 56 bytes in 2 blocks
==5574== suppressed: 0 bytes in 0 blocks
==5574== Reachable blocks (those to which a pointer was found) are not
shown.
==5574== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==5574==
==5574== For counts of detected and suppressed errors, rerun with: -v
==5574== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
}}}
Master:
{{{
==17645== Memcheck, a memory error detector
==17645== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==17645== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for
copyright info
==17645== Command: ./a.out
==17645==
==17645==
==17645== HEAP SUMMARY:
==17645== in use at exit: 416 bytes in 10 blocks
==17645== total heap usage: 65 allocs, 55 frees, 81,848 bytes allocated
==17645==
==17645== 360 (88 direct, 272 indirect) bytes in 1 blocks are definitely
lost in loss record 10 of 10
==17645== at 0x4837DEF: operator new(unsigned long)
(vg_replace_malloc.c:334)
==17645== by 0x4B854B3: geos::noding::(anonymous
namespace)::SegmentStringExtractor::filter_ro(geos::geom::Geometry const*)
(GeometryNoder.cpp:61)
==17645== by 0x4B85372:
geos::noding::GeometryNoder::extractSegmentStrings(geos::geom::Geometry
const&, std::vector<geos::noding::SegmentString*,
std::allocator<geos::noding::SegmentString*> >&) (GeometryNoder.cpp:157)
==17645== by 0x4B8581B: geos::noding::GeometryNoder::getNoded()
(GeometryNoder.cpp:123)
==17645== by 0x4B859E5:
geos::noding::GeometryNoder::node(geos::geom::Geometry const&)
(GeometryNoder.cpp:80)
==17645== by 0x4865497: GEOSNode_r (geos_ts_c.cpp:2450)
==17645== by 0x109300: main (in /home/raul/dev/public/geos/a.out)
==17645==
==17645== LEAK SUMMARY:
==17645== definitely lost: 88 bytes in 1 blocks
==17645== indirectly lost: 272 bytes in 7 blocks
==17645== possibly lost: 0 bytes in 0 blocks
==17645== still reachable: 56 bytes in 2 blocks
==17645== suppressed: 0 bytes in 0 blocks
==17645== Reachable blocks (those to which a pointer was found) are not
shown.
==17645== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==17645==
==17645== For counts of detected and suppressed errors, rerun with: -v
==17645== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
}}}
Only initGeos() and finishGeos() in the script:
3.7.0:
{{{
==6083== Memcheck, a memory error detector
==6083== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6083== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright
info
==6083== Command: ./a.out
==6083==
==6083==
==6083== HEAP SUMMARY:
==6083== in use at exit: 56 bytes in 2 blocks
==6083== total heap usage: 10 allocs, 8 frees, 80,096 bytes allocated
==6083==
==6083== LEAK SUMMARY:
==6083== definitely lost: 0 bytes in 0 blocks
==6083== indirectly lost: 0 bytes in 0 blocks
==6083== possibly lost: 0 bytes in 0 blocks
==6083== still reachable: 56 bytes in 2 blocks
==6083== suppressed: 0 bytes in 0 blocks
==6083== Reachable blocks (those to which a pointer was found) are not
shown.
==6083== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==6083==
==6083== For counts of detected and suppressed errors, rerun with: -v
==6083== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
}}}
Master:
{{{
==26299== Memcheck, a memory error detector
==26299== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==26299== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for
copyright info
==26299== Command: ./a.out
==26299==
==26299==
==26299== HEAP SUMMARY:
==26299== in use at exit: 56 bytes in 2 blocks
==26299== total heap usage: 10 allocs, 8 frees, 80,096 bytes allocated
==26299==
==26299== LEAK SUMMARY:
==26299== definitely lost: 0 bytes in 0 blocks
==26299== indirectly lost: 0 bytes in 0 blocks
==26299== possibly lost: 0 bytes in 0 blocks
==26299== still reachable: 56 bytes in 2 blocks
==26299== suppressed: 0 bytes in 0 blocks
==26299== Reachable blocks (those to which a pointer was found) are not
shown.
==26299== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==26299==
==26299== For counts of detected and suppressed errors, rerun with: -v
==26299== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
}}}
The issue are not the still reachable blocks, they refer to the default
geometry factory. The issue are the `indirectly lost` and `definitely
lost` blocks when using `GEOSNode` in master.
--
Ticket URL: <https://trac.osgeo.org/geos/ticket/923#comment:15>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).
More information about the geos-devel
mailing list