[Gdal-dev] Free SRSs allocated with OGRSFDriverRegistrar::Open?

Frank Warmerdam warmerdam at pobox.com
Mon Oct 23 23:18:42 EDT 2006

Craig Miller wrote:
> In an ongoing effort to remove memory leaks and better understand GDAL/OGRs
> memory management I'm still observing quite a few leaks.  Is there a global
> command to free random SRS related info that gets allocated as a normal part
> of using OGR?  I thought I saw one when browsing the class documentation the
> other day, but I can't seem to locate it now.
> I believe that I'm observing a memory leak when I allocate a Datsource with 


I have confirmed and fixed this memory leak in CVS.  It turns out the
FetchSRS() method was not incrementing nKnownSRID so the destructor
was never trying to release the spatial reference.

I also found that the CVS code in OGRPGTableLayer::GetSpatialRef() was
not querying against the proper schema field and so in fact spatial
references were never successfully fetched in the CVS OGR version.
I'm not sure if this is a recent problem or not ... I think the schema
support is pretty recent.

This is also now fixed.

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    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list