[geos-devel] possible memory leak in InteriorPointArea
Peter Körner
osm-lists at mazdermind.de
Tue Sep 6 16:07:10 EDT 2011
Hi guys!
I guess I'm just using the InteriorPointArea wrong, but I get a
memory-leak reported in valgrind:
==2887== 168 (48 direct, 120 indirect) bytes in 1 blocks are definitely
lost in loss record 26 of 27
==2887== at 0x4C28B42: operator new(unsigned long)
(vg_replace_malloc.c:261)
==2887== by 0x5BB3622:
geos::geom::GeometryFactory::createLineString(geos::geom::CoordinateSequence*)
const (in /usr/lib/libgeos-3.2.0.so)
==2887== by 0x5B9DE12:
geos::algorithm::InteriorPointArea::addPolygon(geos::geom::Geometry
const*) (in /usr/lib/libgeos-3.2.0.so)
==2887== by 0x5B9DFF9:
geos::algorithm::InteriorPointArea::InteriorPointArea(geos::geom::Geometry
const*) (in /usr/lib/libgeos-3.2.0.so)
==2887== by 0x413F10: ImportHandler::write_way() (handler.hpp:397)
==2887== by 0x414B0B:
Osmium::Input::XML<ImportHandler>::end_element_wrapper(void*, char
const*) (handler.hpp:328)
==2887== by 0x4E398E4: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.5.2)
==2887== by 0x4E3A77D: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.5.2)
==2887== by 0x4E3C6E1: XML_ParseBuffer (in
/lib/x86_64-linux-gnu/libexpat.so.1.5.2)
==2887== by 0x414CB0: Osmium::Input::XML<ImportHandler>::parse()
(xml.hpp:98)
==2887== by 0x4121AF: void
Osmium::OSMFile::read<ImportHandler>(ImportHandler&) (osmfile_impl.hpp:35)
==2887== by 0x4071BB: main (importer.cpp:59)
The relevant code lines are as follows:
// calculate interior point
try {
geos::geom::Coordinate center;
geos::algorithm::InteriorPointArea interior_calculator(poly);
interior_calculator.getInteriorPoint(center);
// write interior point
line << "SRID=900913;POINT(" << center.x << ' ' << center.x << ')';
} catch(geos::util::GEOSException e) {
std::cerr << "error calculating interior point: " << e.what() << std::endl;
line << "\\N";
}
Looking at InteriorPointArea.cpp I really don't see where an "operator
new" could be called. Anyone some ideas what's happening here?
Peter
More information about the geos-devel
mailing list