[gdal-dev] How to delete GDALDriver objects
Frank Warmerdam
warmerdam at pobox.com
Tue May 27 11:39:47 EDT 2008
Kor de Jong wrote:
> Hi all,
>
> I am working on making Valgrind happy with my code and fixed a memory
> leak related to GDALDriver objects not being released once my
> application ends.
>
> I call GDALAllRegister() and GDALDestroyDriverManager() at the appropriate
> times and I think I just found out that GDALDestroyDriverManager() does
> not free the memory allocated by the individual GDALDriver objects. Am
> I right?
>
> Now I call GDALDriverManager::DeregisterDriver(driver) for each driver
> and delete the driver afterwards. This makes Valgrind much happier. But
> I guess I am in for some suprises on the Windows platform since I am
> deleting objects that have been allocated by the GDal shared library.
>
> My question is: how should I free the individual drivers allocated by
> the GDal shared library? Is there a function similar to GDALClose, but
> than for GDALDriver objects?
Kor,
GDALDestroyDriverManager() should destroy all the drivers registered
with the manager before destroying the manager and should be the main
way of cleaning up.
This is what gdalinfo does, and it seems to work quite clean with valgrind.
So perhaps you need to provide more info.
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