diff --git a/frontend/document/doccache.lua b/frontend/document/doccache.lua index 0cc7c2be8..95b9961b6 100644 --- a/frontend/document/doccache.lua +++ b/frontend/document/doccache.lua @@ -15,7 +15,8 @@ local DHINTCOUNT = G_defaults:readSetting("DHINTCOUNT") local function calcCacheMemSize() local min = G_defaults:readSetting("DGLOBAL_CACHE_SIZE_MINIMUM") local max = G_defaults:readSetting("DGLOBAL_CACHE_SIZE_MAXIMUM") - local calc = util.calcFreeMem() * (G_defaults:readSetting("DGLOBAL_CACHE_FREE_PROPORTION") or 0) + local memfree, _ = util.calcFreeMem() or 0, 0 + local calc = memfree * G_defaults:readSetting("DGLOBAL_CACHE_FREE_PROPORTION") return math.min(max, math.max(min, calc)) end local doccache_size = calcCacheMemSize()