[geos-devel] Finding the Leak
Paul Ramsey
pramsey at cleverelephant.ca
Mon Aug 18 19:53:27 EDT 2008
I had a few spare minutes today and poked around the area of the
biggest leak...
I see this construct in the PostGIS side in get_prepared_geometry_cache
if ( !cache->prepared_geom )
{
LWDEBUGF(3, "get_prepared_geometry_cache: preparing obj");
g = POSTGIS2GEOS( serialized_geom);
cache->prepared_geom = GEOSPrepare( g);
}
So, a GEOS geometry is being created, and then converted into a
prepared geometry, but *not* destroyed. Attempting to destroy the
geometry right away leads to a crash, presumably because the
PreparedGeometry contains a reference to it in baseGeom?
Later in the life cycle, the prepared geometry gets destroyed,
GEOSPreparedGeom_destroy( cache->prepared_geom);
But, in the PreparedGeometry destructor, the baseGeom is not destroyed...
PreparedPolygon::
~PreparedPolygon( )
{
delete segIntFinder;
delete ptOnGeomLoc;
for ( size_t i = 0, ni = segStrings.size(); i < ni; i++ )
{
delete segStrings[ i ]->getCoordinates();
delete segStrings[ i ];
}
}
I guess this makes sense (not to always destroy the base geometry in
the GEOS code), but in our code that means the geometry is allocated
but not destroyed, yes?
Can saner heads than me confirm my analysis?
P.
More information about the geos-devel
mailing list