[Gdal-dev] Memory Leak in RasterIO?

Frank Warmerdam warmerdam at pobox.com
Mon Oct 20 13:17:33 EDT 2003


lxnyce at bellsouth.net wrote:
> Has anyone else notice that every call to GDALRasterIO seems to be leaking memory with the latest and previous CVS versions of GDAL for a while now. I don't know about the official release. I have observed this using GeoTIFF and IMG files (the only ones I have tried). 
> 
> I came to the conclusion that the leak is in GDALRasterIO (or one of its sub-functions) because if I comment out that line alone, I get no memory leak. Everything else works as it should, just garbage values. I also notice that it occurs with or without the use of overviews. I have tried flushing the cache for every band, and still nothing. When I check the size of the block cache, its the default, ~5Megs.
> 
> Its pretty serious, because after roaming an image for a few iterations, the memory starts climbing. I reach 50megs worth of leaks just within a minute (according to windows task manager physical/virtual memory). The problem is not in my app, I am almost 100% certain of this, but inside that function. 
> 
> Is this a known issue? Can anyone point me in the right direction as to whats going on to leak so much memory? Are there any workarounds?

Hi,

I haven't observed this myself, but it is possible.  But I just did a quick
test with valgrind when using gdal_translate to translate a GeoTIFF file to
GeoTIFF and it didn't seem to have any noteworthy leaks.  What kind of
platform are you working on?  Is your application one on which it would be
practical to run valgrind (a Linux utility) or some other leak tester?  Can
you provide a simple commandline program and input file that demonstrates
your problem?

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