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

Unified Diff: base/sys_info_win.cc

Issue 2558043007: Fix free memory calculation. (Closed)
Patch Set: Fix integer overflow in unittest. Created 3 years, 9 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 | « base/sys_info_unittest.cc ('k') | chrome/browser/ui/webui/about_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_win.cc
diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc
index cb184bae2589d607919858bacc4a1969353c5e98..d1c485c129e8bc117760baa6f9dc6b55cd8b85a3 100644
--- a/base/sys_info_win.cc
+++ b/base/sys_info_win.cc
@@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/logging.h"
+#include "base/process/process_metrics.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "base/win/windows_version.h"
@@ -68,7 +69,10 @@ int64_t SysInfo::AmountOfPhysicalMemory() {
// static
int64_t SysInfo::AmountOfAvailablePhysicalMemory() {
- return AmountOfMemory(&MEMORYSTATUSEX::ullAvailPhys);
+ SystemMemoryInfoKB info;
+ if (!GetSystemMemoryInfo(&info))
+ return 0;
+ return static_cast<int64_t>(info.avail_phys) * 1024;
}
// static
« no previous file with comments | « base/sys_info_unittest.cc ('k') | chrome/browser/ui/webui/about_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698