From 6b04633a99730f13518fccd27c32c65c59762763 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 22 May 2017 15:47:10 +0200
Subject: [PATCH] [WTF] Compilation fails with system malloc
---
Source/WTF/wtf/RAMSize.cpp | 12 +++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/Source/WTF/wtf/RAMSize.cpp b/Source/WTF/wtf/RAMSize.cpp
index b017a26bde3..c647307ab91 100644
--- a/Source/WTF/wtf/RAMSize.cpp
+++ b/Source/WTF/wtf/RAMSize.cpp
@@ -31,12 +31,16 @@
#if OS(WINDOWS)
#include <windows.h>
+#if defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
+#if OS(UNIX)
+#include <sys/sysinfo.h>
+#endif // OS(UNIX)
#else
#include <bmalloc/bmalloc.h>
#endif
namespace WTF {
-
+
#if OS(WINDOWS)
static const size_t ramSizeGuess = 512 * MB;
#endif
@@ -50,6 +54,12 @@ static size_t computeRAMSize()
if (!result)
return ramSizeGuess;
return status.ullTotalPhys;
+#elif defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
+#if OS(UNIX)
+ struct sysinfo si;
+ sysinfo(&si);
+ return si.totalram / MB;
+#endif // OS(UNIX)
#else
return bmalloc::api::availableMemory();
#endif
--
2.13.0