[geos-devel] How to destroy PreparedGeometry object?

Martin Davis mbdavis at refractions.net
Mon Aug 11 19:32:39 EDT 2008


Sure, sounds good - I agree with your reasoning.  Simpler is better!

Mateusz Loskot wrote:
> Martin Davis wrote:
>> Ugh.
>>
>> Sounds like we need a 
>> PreparedGeometryFactory::destroyPreparedGeometry(PreparedGeometry *) 
>> method, then - as per your suggestion.
>
> or just
>
> PreparedGeometryFactory::destroy(PreparedGeometry* )
>
> as we have prepare() and create() but not preparePreparedGeometry etc.
>
> (Actually, I would vote for renaming destroyGeometry() to just 
> destroy() from the same reasons, but I understand it's likely 
> impossible as it breaks public API)
>
>> Does this same situation exist for all objects which might be 
>> allocated on the heap?
>
> Yes, it does exist for all objects that:
> a) are allocated on the heap
> b) and are returned outside GEOS, to user
> c) and the ownership is transfered to user
>
>
> The c) means that a user is responsible for destroying it.
>
>> There's lots of classes in GEOS "below the Geometry level" which 
>> might be used by a coder using the C++ API.  Perhaps there should be 
>> a warning about this (in the non-existent FAQ?)
>
> Yes, FAQ is good, but empty:
>
> http://trac.osgeo.org/geos/wiki/FAQ
>
> The explanation can be stolen from GDAL FAQ with some changes related 
> to GEOS. Before I compile something, I need to find more examples of 
> potentially dangerous places in GEOS.
>
> Best regards

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022



More information about the geos-devel mailing list