aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Support/MemoryUsage.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2014-09-12 13:45:46 -0700
committerDaniel Dunbar <daniel@zuster.org>2014-09-12 17:39:17 -0700
commit4444e21e7926ca079583f14a51cca0bf5e01b711 (patch)
treea3301e8d01426e944766b037b40dcb9b181cceea /lib/Support/MemoryUsage.cpp
parente01706cfb754aca4b2c1b2c15428115df46742be (diff)
downloadklee-4444e21e7926ca079583f14a51cca0bf5e01b711.tar.gz
Do not require mallinfo(), which is Linux specific.
Diffstat (limited to 'lib/Support/MemoryUsage.cpp')
-rw-r--r--lib/Support/MemoryUsage.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Support/MemoryUsage.cpp b/lib/Support/MemoryUsage.cpp
index 676ce307..6143b127 100644
--- a/lib/Support/MemoryUsage.cpp
+++ b/lib/Support/MemoryUsage.cpp
@@ -8,11 +8,17 @@
//===----------------------------------------------------------------------===//
#include "klee/Internal/System/MemoryUsage.h"
+
+#include "klee/Config/config.h"
+
+#ifdef HAVE_MALLINFO
#include <malloc.h>
+#endif
using namespace klee;
size_t util::GetTotalMallocUsage() {
+#ifdef HAVE_MALLINFO
struct mallinfo mi = ::mallinfo();
// The malloc implementation in glibc (pmalloc2)
// does not include mmap()'ed memory in mi.uordblks
@@ -22,4 +28,11 @@ size_t util::GetTotalMallocUsage() {
#else
return mi.uordblks;
#endif
+
+#else // HAVE_MALLINFO
+
+#warning Cannot get malloc info on this platform
+ return 0;
+
+#endif
}