[geos-devel] Finding the Leak

Mateusz Loskot mateusz at loskot.net
Tue Aug 19 12:35:05 EDT 2008


Paul Ramsey wrote:
> This is where I was headed this morning until I had two children 
> dropped on me. There needs to be an accessor for baseGeom in the capi
>  so that PostGIS can actually manage the destruction of the Geometry.
>  BTW have a look at the _destroy functions in capi and tell me if it 
> would be better to run the factory destruction than what is there now
>  (simple delete).

Paul,

AFAIU, purpose of keeping link to parent factory in Geometry object is
that it's used for "reflection" purposes, so users can query Geometry
object for factory properties (precision model, etc.) that were used to
construct that geometry.

If my understanding above is correct, then there is no semantical
difference between calling delete operator on pointer to Geometry object
and using GeometryFactory::destroyGeometry() to deallocate geometry.

The situation would be different if GeometryFactory manages list of
geometries it created, but this is not the case here.

However, considering problems while crossing boundaries of DLL binaries
under Windows, I'd use deallocators provided by factory classes.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the geos-devel mailing list