[Gdal-dev] How to clean up gdal rasters in python?
Frank Warmerdam
warmerdam at pobox.com
Tue May 22 09:06:20 EDT 2007
Jose Luis Gomez Dans wrote:
> Hi! I have a python program that reprojects a large number of large images.
> Often, it crashes with an out of memory error (GDAL 1.4.0, HDF driver on
> Linux/i386). I create many rasters, open them (with gdal.Open()), but
> assumed that Pythons Garbage Collector was looking after my memory. Before I
> delve deeper into the code, I'd like to know whether it is good practice to
> delete gdal handlers in Python. This is for old-gen python, but I wonder
> whether it has changed/will change for ngpython. The Python bit of the API
> tutorial does not mention cleaning up for Python...
Jose,
Generally speaking the old and new python bindings properly clean up datasets
when there are no python references to them anymore.
It is possible you are suffering from bug 1485 which results in internal HDF
resources not being properly released for some datasets:
http://trac.osgeo.org/gdal/ticket/1485
You could try out the very latest FWTools or build from the latest trunk or
1.4 branch source if you suspect that is the issue.
It is also possible that there are reference counting problems in the bindings
in some complex circumstances that may be impacting you. If you can provide
a bug report sufficient for us to easily reproduce the problem we might be able
to dig into it.
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