[geos-devel] [GEOS] #587: Memory leak in geos trunk

GEOS geos-trac at osgeo.org
Mon Sep 10 03:09:10 PDT 2012


#587: Memory leak in geos trunk
------------------------+---------------------------------------------------
 Reporter:  bradh       |       Owner:  geos-devel@…              
     Type:  defect      |      Status:  new                       
 Priority:  minor       |   Milestone:  3.4.0                     
Component:  Default     |     Version:  svn-trunk                 
 Severity:  Unassigned  |    Keywords:                            
------------------------+---------------------------------------------------
 I'm working on an application that uses GEOS indirectly (via SpatiaLite).
 In earlier versions of GEOS, it was valgrind-clean (no memory leaks). With
 trunk, I see two minor leaks, both of which come from initGEOS().


 {{{
 ==7181== 16 bytes in 1 blocks are still reachable in loss record 1 of 2
 ==7181==    at 0x4C28B35: operator new(unsigned long)
 (vg_replace_malloc.c:261)
 ==7181==    by 0x6C7133E: geos::geom::GeometryFactory::GeometryFactory()
 (GeometryFactory.cpp:86)
 ==7181==    by 0x6C7400E:
 geos::geom::GeometryFactory::getDefaultInstance()
 (GeometryFactory.cpp:728)
 ==7181==    by 0x6874B5C: initGEOS_r (geos_ts_c.cpp:206)
 ==7181==    by 0x6872ACD: initGEOS (geos_c.cpp:98)
 ==7181==    by 0x51B8BFA: spatialite_init (spatialite.c:21708)
 ==7181==    by 0x40092C: main (check_point_to_tile_wrong_arg_type.c:61)
 ==7181==
 ==7181== 32 bytes in 1 blocks are still reachable in loss record 2 of 2
 ==7181==    at 0x4C28B35: operator new(unsigned long)
 (vg_replace_malloc.c:261)
 ==7181==    by 0x6C74003:
 geos::geom::GeometryFactory::getDefaultInstance()
 (GeometryFactory.cpp:728)
 ==7181==    by 0x6874B5C: initGEOS_r (geos_ts_c.cpp:206)
 ==7181==    by 0x6872ACD: initGEOS (geos_c.cpp:98)
 ==7181==    by 0x51B8BFA: spatialite_init (spatialite.c:21708)
 ==7181==    by 0x40092C: main (check_point_to_tile_wrong_arg_type.c:61)
 }}}

 Note that there is a call to finishGEOS() which cleans up most, but not
 all, of the memory leak.

 I did try investigating this, and deleting the defInstance did fix the
 memory leak, but it completely broke on threaded applications.

-- 
Ticket URL: <http://trac.osgeo.org/geos/ticket/587>
GEOS <http://geos.refractions.net/>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list