[gdal-dev] Memory leak from GDALRasterIO

Kevin F Webb kfw4 at cornell.edu
Tue Aug 3 15:57:34 EDT 2010


-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: Thursday, July 29, 2010 4:35 PM
To: Kevin F Webb
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] Memory leak from GDALRasterIO

Kevin F Webb wrote: 
> 
> I am experiencing a memory leak from looped calls to GDALRasterIO(). It 
> may be something I am doing improperly
> because I use/call RasterIO() in a C++ program that runs leak free.
> 

Kevin,

You haven't shown your code, but I suspect you aren't closing the
datasource and so the block cache isn't getting cleaned up.


I misrepresented this issue as a "Memory Leak." There was no leak, all resources
were in fact being recovered by GDALClose(). What I did experience was resource 
allocation during each loop on GDALRasterIO() such that it appeared that the heap 
was exhausted. 

With some off-list help from Frank, he directed me to the API calls for 
GDALFlushCacheBlock(), and GDALSetCacheMax() which have solved my problem.

Thank you Frank!


KFW


More information about the gdal-dev mailing list