[gdal-dev] Re: python SetCacheMax, GetCacheMax

Even Rouault even.rouault at mines-paris.org
Mon May 14 13:56:53 EDT 2012


Le lundi 14 mai 2012 19:16:25, Matt Gregory a écrit :
> 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.

Not a good reason actually. The workaround you've found is actually what is 
needed without the fix I've committed in trunk ( 
http://trac.osgeo.org/gdal/changeset/24412 )

> 
> matt
> 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list