[geos-devel] New memory leaks in the 2.2 branch since 2.2.1?

strk at refractions.net strk at refractions.net
Thu Mar 30 04:25:25 EST 2006


It looks like you're not deleting the Geometries returned
by some functions. If youre *positive* you do are releasing
that memory there might be the same horrible bug I'm hunting
in the HEAD branch: memory corruption, confusing every
memory checker I've tested so far.

--strk;


On Thu, Mar 30, 2006 at 01:45:12AM -0700, Sean Gillies wrote:
> strk,
> 
> I have a program that was running almost leak free with GEOS 2.2.1,  
> but I am seeing leaks now with the head of the 2.2 branch. I'm using  
> valgrind.
> 
> ==16249==
> ==16249== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 9361  
> from 7)
> ==16249== malloc/free: in use at exit: 1468711 bytes in 1164 blocks.
> ==16249== malloc/free: 30535 allocs, 29371 frees, 4851492 bytes  
> allocated.
> ==16249== For counts of detected errors, rerun with: -v
> ==16249== searching for pointers to 1164 not-freed blocks.
> ==16249== checked 14088580 bytes.
> ==16249==
> ==16249== 16 bytes in 1 blocks are definitely lost in loss record 10  
> of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1CA4D124: initGEOS (geos_c.cpp:162)
> ==16249==    by 0x1C090677: init_geom (_geommodule.c:2197)
> ==16249==    by 0x80CB80D: _PyImport_LoadDynamicModule (importdl.c:53)
> 
> ^^^^^
> This 16 bytes was the only leak I saw in 2.2.1.
> 
> Here are the new ones:
> 
> ==16249==
> ==16249==
> ==16249== 24 bytes in 1 blocks are definitely lost in loss record 14  
> of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C7C6B: geos::GeometryFactory::createLinearRing 
> (geos::CoordinateSequence*) const (GeometryFactory.cpp:423)
> ==16249==    by 0x1CA5223E: GEOSGeom_createLinearRing (geos_c.cpp:1938)
> ==16249==    by 0x1C0911AE: Geometry_copyFromCoordSeq (_geommodule.c: 
> 676)
> ==16249==
> ==16249==
> ==16249== 48 bytes in 2 blocks are definitely lost in loss record 23  
> of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C7D13: geos::GeometryFactory::createMultiPoint 
> (std::vector<geos::Geometry*, std::allocator<geos::Geometry*> >*)  
> const (GeometryFactory.cpp:459)
> ==16249==    by 0x1C504E5F: geos::WKBReader::readMultiPoint()  
> (WKBReader.cpp:195)
> ==16249==    by 0x1C5044DC: geos::WKBReader::readGeometry()  
> (WKBReader.cpp:113)
> ==16249==
> ==16249==
> ==16249== 72 bytes in 3 blocks are definitely lost in loss record 29  
> of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C7A33: geos::GeometryFactory::createMultiPolygon 
> (std::vector<geos::Geometry*, std::allocator<geos::Geometry*> >*)  
> const (GeometryFactory.cpp:362)
> ==16249==    by 0x1C505517: geos::WKBReader::readMultiPolygon()  
> (WKBReader.cpp:243)
> ==16249==    by 0x1C5044F9: geos::WKBReader::readGeometry()  
> (WKBReader.cpp:117)
> ==16249==
> ==16249==
> ==16249== 72 bytes in 3 blocks are definitely lost in loss record 30  
> of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C74BB:  
> geos::GeometryFactory::createMultiLineString 
> (std::vector<geos::Geometry*, std::allocator<geos::Geometry*> >*)  
> const (GeometryFactory.cpp:234)
> ==16249==    by 0x1C5051BB: geos::WKBReader::readMultiLineString()  
> (WKBReader.cpp:219)
> ==16249==    by 0x1C5044E9: geos::WKBReader::readGeometry()  
> (WKBReader.cpp:115)
> ==16249==
> ==16249==
> ==16249== 264 bytes in 11 blocks are definitely lost in loss record  
> 45 of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C833F: geos::GeometryFactory::createLineString 
> (geos::CoordinateSequence*) const (GeometryFactory.cpp:613)
> ==16249==    by 0x1CA5235A: GEOSGeom_createLineString (geos_c.cpp:1961)
> ==16249==    by 0x1C091218: Geometry_copyFromCoordSeq (_geommodule.c: 
> 673)
> ==16249==
> ==16249==
> ==16249== 308 bytes in 11 blocks are definitely lost in loss record  
> 48 of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C80CF: geos::GeometryFactory::createPolygon 
> (geos::LinearRing*, std::vector<geos::Geometry*,  
> std::allocator<geos::Geometry*> >*) const (GeometryFactory.cpp:554)
> ==16249==    by 0x1C501846: geos::WKTReader::readPolygonText 
> (geos::StringTokenizer*) (WKTReader.cpp:242)
> ==16249==    by 0x1C501270: geos::WKTReader::readGeometryTaggedText 
> (geos::StringTokenizer*) (WKTReader.cpp:173)
> ==16249==
> ==16249==
> ==16249== 432 bytes in 18 blocks are definitely lost in loss record  
> 53 of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C77FB:  
> geos::GeometryFactory::createGeometryCollection 
> (std::vector<geos::Geometry*, std::allocator<geos::Geometry*> >*)  
> const (GeometryFactory.cpp:304)
> ==16249==    by 0x1C501F20:  
> geos::WKTReader::readGeometryCollectionText(geos::StringTokenizer*)  
> (WKTReader.cpp:296)
> ==16249==    by 0x1C501310: geos::WKTReader::readGeometryTaggedText 
> (geos::StringTokenizer*) (WKTReader.cpp:181)
> ==16249==
> ==16249==
> ==16249== 1776 bytes in 74 blocks are definitely lost in loss record  
> 65 of 78
> ==16249==    at 0x1B904BF7: operator new(unsigned)  
> (vg_replace_malloc.c:133)
> ==16249==    by 0x1C4C738F: geos::GeometryFactory::createPoint 
> (geos::CoordinateSequence*) const (GeometryFactory.cpp:183)
> ==16249==    by 0x1CA52122: GEOSGeom_createPoint (geos_c.cpp:1915)
> ==16249==    by 0x1C0911F2: Geometry_copyFromCoordSeq (_geommodule.c: 
> 670)
> ==16249==
> ==16249== LEAK SUMMARY:
> ==16249==    definitely lost: 3012 bytes in 124 blocks.
> ==16249==    possibly lost:   0 bytes in 0 blocks.
> ==16249==    still reachable: 1465499 bytes in 1039 blocks.
> ==16249==         suppressed: 200 bytes in 1 blocks.
> ==16249== Reachable blocks (those to which a pointer was found) are  
> not shown.
> ==16249== To see them, rerun with: --show-reachable=yes
> [sean at lenny tests]$
> 
> Any ideas?
> 
> ---
> Sean Gillies
> http://zcologia.com
> 
> 
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel

-- 

 /"\    ASCII Ribbon Campaign
 \ /    Respect for low technology.
  X     Keep e-mail messages readable by any computer system.
 / \    Keep it ASCII. 




More information about the geos-devel mailing list