From 8d501fc43a6f68b916cbc2aa074c33fc36cdbf2d Mon Sep 17 00:00:00 2001 From: Kevin Slagle Date: Sun, 1 Mar 2020 16:42:39 -0800 Subject: [PATCH] getFreeMemory is called every two seconds when checking to see if the system is low on memory. Before this commit, half of these checks are useless (when okular is idle) since the cache is used when the cache is <=2 seconds old. This means that after they system is out of memory, up to 4 seconds (instead of 2) could go by before okular starts to free memory. --- core/document.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/document.cpp b/core/document.cpp index d7e558530..f610b7d20 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -434,7 +434,7 @@ qulonglong DocumentPrivate::getFreeMemory( qulonglong *freeSwap ) static qulonglong cachedValue = 0; static qulonglong cachedFreeSwap = 0; - if ( qAbs( lastUpdate.secsTo( QTime::currentTime() ) ) <= 2 ) + if ( qAbs( lastUpdate.msecsTo( QTime::currentTime() ) ) <= 1900 ) { if (freeSwap) *freeSwap = cachedFreeSwap;