Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: content/browser/memory/memory_monitor_linux.cc

Issue 2448923004: memory coordinator: Use free memory to guess available memory on Linux (Closed)
Patch Set: fix test expectation Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/memory/memory_monitor_linux_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_monitor_linux.cc
diff --git a/content/browser/memory/memory_monitor_linux.cc b/content/browser/memory/memory_monitor_linux.cc
index 08cf8027b0313811292ff36abc27be4ddf24c75b..68421c8c4e12b9fe3ca47c5927c1c975a7586c9c 100644
--- a/content/browser/memory/memory_monitor_linux.cc
+++ b/content/browser/memory/memory_monitor_linux.cc
@@ -33,9 +33,11 @@ int MemoryMonitorLinux::GetFreeMemoryUntilCriticalMB() {
if (mem_info.available > 0)
return mem_info.available >> kShiftKiBtoMiB;
- // If there is no "available" value, guess at it based on free memory and
- // what the OS can easily discard.
- return (mem_info.free + mem_info.buffers + mem_info.cached) >> kShiftKiBtoMiB;
+ // If there is no "available" value, guess at it based on free memory.
+ // Though there will be easily discardable memory (buffers and caches), we
+ // don't count them because discarding them will affect the overall
+ // performance of the OS.
+ return mem_info.free >> kShiftKiBtoMiB;
}
// static
« no previous file with comments | « no previous file | content/browser/memory/memory_monitor_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698