MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPL_STDCALL GDALGetCacheMax64

Function CPL_STDCALL GDALGetCacheMax64

gcore/gdalrasterblock.cpp:215–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 */
214
215GIntBig CPL_STDCALL GDALGetCacheMax64()
216{
217 static std::once_flag flagSetupGDALGetCacheMax64;
218 std::call_once(
219 flagSetupGDALGetCacheMax64,
220 []()
221 {
222 {
223 INITIALIZE_LOCK;
224 }
225 bSleepsForBockCacheDebug =
226 CPLTestBool(CPLGetConfigOption("GDAL_DEBUG_BLOCK_CACHE", "NO"));
227
228 const char *pszCacheMax = CPLGetConfigOption("GDAL_CACHEMAX", "5%");
229 GIntBig nNewCacheMax;
230 bool bUnitSpecified = false;
231
232 if (CPLParseMemorySize(pszCacheMax, &nNewCacheMax,
233 &bUnitSpecified) != CE_None)
234 {
235 CPLError(CE_Failure, CPLE_NotSupported,
236 "Invalid value for GDAL_CACHEMAX. "
237 "Using default value.");
238 if (CPLParseMemorySize("5%", &nNewCacheMax, &bUnitSpecified) !=
239 CE_None)
240 {
241 // This means that usable physical RAM could not be determined.
242 nNewCacheMax = nCacheMax;
243 }
244 }
245
246 if (!bUnitSpecified && nNewCacheMax < 100000)
247 {
248 // Assume MB
249 nNewCacheMax *= (1024 * 1024);
250 }
251
252 nCacheMax = nNewCacheMax;
253 CPLDebug("GDAL", "GDAL_CACHEMAX = " CPL_FRMT_GIB " MB",
254 nCacheMax / (1024 * 1024));
255 });
256
257 return nCacheMax;
258}
259
260/************************************************************************/
261/* GDALGetCacheUsed() */

Callers

nothing calls this directly

Calls 4

CPLTestBoolFunction · 0.85
CPLParseMemorySizeFunction · 0.85
CPLErrorFunction · 0.85
CPLDebugFunction · 0.85

Tested by

no test coverage detected