about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--autoconf/configure.ac3
-rw-r--r--lib/Support/MemoryUsage.cpp13
2 files changed, 14 insertions, 2 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 54bc3d32..f1b2dfc3 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -500,8 +500,7 @@ dnl Test for features
 dnl **************************************************************************
 AC_SEARCH_LIBS(mallinfo,malloc,
                AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]),
-               AC_MSG_ERROR([mallinfo() must be supported by your malloc implementation])
-              )
+               AC_MSG_WARN([mallinfo() was not found - disabling memory usage checking]))
 
 dnl **************************************************************************
 dnl Find an install of STP
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
 }