[gdal-dev] GDALDestroyDriverManager() - dataset cleanup

Frank Warmerdam warmerdam at pobox.com
Tue Feb 8 21:31:34 EST 2011


Folks,

I have modified GDALDriverManager::~GDALDriverManager() so that when
it is destroyed it will first close all still-open GDAL datasets.  A debug
message will be issued for each dataset force-closed.

This is part of an effort to ensure a clean shutdown and to make it easier
to detect memory leaks in some situations.

This is not a completely safe operation.  In particular, if there are VRT
files referencing other GDALDataset's the referenced dataset may be cleaned
up before the referencing dataset which would be bad.

I need this primarily for cleanup in MapServer where GDAL datasets are now
normally left open (CLOSE_CONNECTION=DEFER).

If this automatic dataset description causes problems we can disable or
remove it before the GDAL 1.9 release.  But it seems relatively harmless
to incorporate in trunk for the time being.

   http://trac.osgeo.org/gdal/changeset/21662

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