MCPcopy Create free account
hub / github.com/OSGeo/gdal / GetCacheMax

Function GetCacheMax

port/cpl_vsil_cache.cpp:110–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108/************************************************************************/
109
110static size_t GetCacheMax(size_t nCacheSize)
111{
112 if (nCacheSize)
113 {
114 return nCacheSize;
115 }
116
117 const char *pszCacheSize = CPLGetConfigOption("VSI_CACHE_SIZE", "25000000");
118 GIntBig nMemorySize;
119 bool bUnitSpecified;
120 if (CPLParseMemorySize(pszCacheSize, &nMemorySize, &bUnitSpecified) !=
121 CE_None)
122 {
123 CPLError(
124 CE_Failure, CPLE_IllegalArg,
125 "Failed to parse value of VSI_CACHE_SIZE. Using default of 25MB");
126 nMemorySize = 25000000;
127 }
128 else if (static_cast<size_t>(nMemorySize) >
129 std::numeric_limits<size_t>::max() / 2)
130 {
131 nMemorySize =
132 static_cast<GIntBig>(std::numeric_limits<size_t>::max() / 2);
133 }
134
135 return static_cast<size_t>(nMemorySize);
136}
137
138/************************************************************************/
139/* VSICachedFile() */

Callers 1

VSICachedFileMethod · 0.85

Calls 3

CPLParseMemorySizeFunction · 0.85
CPLErrorFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected