[Gdal-dev] Memory leak? How to release GDAL datasets?

Craig Miller craig.miller at spatialminds.com
Wed Dec 13 17:41:35 EST 2006


Is GDALClose(m_pDataset) the only method that needs to be called after
opening a GDAL datset?


I'm observing a fair number leaks from calls to OGRPolygon::addRing that get
called as a part of GDALOpen().  From my screendump, they appear to have
something to do with the images SRS.

I'm opening an RGB (3 band) Geotiff with the following command:

GDALAllRegister();
m_pDataset = (GDALDataset *) GDALOpen( m_strFilename, GA_ReadOnly );

And freeing it with:

if (m_pDataset != NULL)
{
    GDALClose(m_pDataset);
    m_pDataset = NULL;
}

Thanks for the help,
Craig






More information about the Gdal-dev mailing list