[gdal-dev] How to delete GDALDriver objects
Frank Warmerdam
warmerdam at pobox.com
Tue May 27 21:48:10 EDT 2008
Kor de Jong wrote:
> For each GDALDriver, I create a home brewn Driver instance. When a
> Driver instance wants to do raster I/O using its GDALDriver, it calls
> GDALDriverManager::DeregisterDriver on the global manager for each
> registered GDALDriver, folowed by a call to
> GDALDriverManager::RegisterDriver for the wrapped GDALDriver.
> So, the driver manager does not contain all GDALDrivers loaded, but
> only the one(s) currently used. Given your comments, this means that
> when GDALDestroyDriverManager() is called, only the GDALDrivers
> registered will be destroyed. The other ones will be left dangling.
>
> In general the question than becomes, how would one free the memory
> taken by a GDALDriver which has been deregistered with the
> GDALDriverManager.
Kor,
OK, understood.
I have added a GDALDestroyDriver() function for this situation (in
trunk). As you note, the direct delete is somewhat risky, and will
cause heap corruption on windows if GDAL and the application are not
using the same heap.
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