[Gdal-dev] Free OGRGeometry?

Craig Miller craig.miller at spatialminds.com
Thu Dec 1 19:28:15 EST 2005


I looked at this a little closer.  You are right, gdal was built with /MD
and my app was in debug mode using /MDd.  I actually have 2 builds of gdal
Release/Debug and forgot to set the /MD flag to /MDd when I did my debug
build.

Good catch.

--Craig
 

-----Original Message-----
From: fwarmerdam at gmail.com [mailto:fwarmerdam at gmail.com] On Behalf Of Frank
Warmerdam
Sent: Friday, November 25, 2005 1:00 PM
To: Craig Miller
Subject: Re: [Gdal-dev] Free OGRGeometry?

On 11/25/05, Craig Miller <craig.miller at spatialminds.com> wrote:
> I should have mentioned that using delete (under windows) is causing 
> an unhandled exception.  I thought that there might be a special CPL* 
> routine that has to be used to prevent this from happening.
>
> I'm using a rect now, but in the future I hope to allow other 
> geometric elements to be used to filter the geometry (like an 
> ecological region, county, etc).

Craig,

I imagine your mainline is not build with /MD, but GDAL13.DLL is.
In that case GDAL uses the MSVCRT heap but your application uses its own
private heap. This can result in all sorts of problems.

Since you did the "new OGRPolygon" in your own code, I would have thought
doing the delete there would also be ok, but perhaps not.

There is also an OGRGeometryFactory::destroyGeometry( OGRGeometry *) method
you can use to destroy a geometry within the GDAL DLL.  This is often useful
if you need to destroy a geometry created by GDAL.

Of course, your exception could be due to some other heap corruption issue.
It is hard to know.

Best regards,
--
---------------------------------------+--------------------------------
---------------------------------------+------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list