[gdal-dev] Re: python SetCacheMax, GetCacheMax

Matt Gregory matt.gregory at oregonstate.edu
Mon May 14 13:16:25 EDT 2012


On 5/11/2012 4:55 PM, Gregory, Matthew wrote:
> Hi all,
>
> Probably a newbie question.  I'm trying to investigate some read rates without the benefit of caching from Python.  When I do this:
>
>    from osgeo import gdal
>    gdal.SetCacheMax(0)
>    print gdal.GetCacheMax()
>
> I always get the environment variable value GDAL_CACHE_MAX instead of 0.  Throughout my test script, I can also query gdal.GetCacheUsed() and it increases toward GDAL_CACHE_MAX.  Am I totally misunderstanding their use?  I'm on Windows 7 64-bit, GDAL version 1.7.

A bit more experimentation led to this:

 >>> from osgeo import gdal
 >>> print gdal.GetCacheMax()
786432000
 >>> gdal.SetCacheMax(0)
 >>> print gdal.GetCacheMax()
0

So, for some reason a call to GetCacheMax has to occur before 
SetCacheMax can be used?  This seems to be working in my testing script.

matt




More information about the gdal-dev mailing list