changeset 415:e37e44681720

* Fix failure to take into account near-OOM situations!
author Chris Cannam
date Mon, 09 Jun 2008 16:01:22 +0000
parents c8955c486340
children a00902d5f0ab
files base/StorageAdviser.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/base/StorageAdviser.cpp	Mon Jun 09 09:41:58 2008 +0000
+++ b/base/StorageAdviser.cpp	Mon Jun 09 16:01:22 2008 +0000
@@ -22,7 +22,7 @@
 
 #include <iostream>
 
-//#define DEBUG_STORAGE_ADVISER 1
+#define DEBUG_STORAGE_ADVISER 1
 
 long StorageAdviser::m_discPlanned = 0;
 long StorageAdviser::m_memoryPlanned = 0;
@@ -85,12 +85,12 @@
     int maxmb = maximumSize / 1024 + 1;
 
     if (memoryFree == -1) memoryStatus = Unknown;
+    else if (memoryFree < memoryTotal / 3) memoryStatus = Insufficient;
     else if (minmb > (memoryFree * 3) / 4) memoryStatus = Insufficient;
     else if (maxmb > (memoryFree * 3) / 4) memoryStatus = Marginal;
     else if (minmb > (memoryFree / 3)) memoryStatus = Marginal;
     else if (memoryTotal == -1 ||
              minmb > (memoryTotal / 10)) memoryStatus = Marginal;
-    else if (memoryFree < memoryTotal / 4) memoryStatus = Marginal;
     else memoryStatus = Sufficient;
 
     if (discFree == -1) discStatus = Unknown;