about summary refs log tree commit diff homepage
path: root/lib/Support/MemoryUsage.cpp
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2016-02-29 14:14:43 +0100
committerMartinNowack <martin.nowack@gmail.com>2016-02-29 14:14:43 +0100
commitce1dd5a7f3de7b536a9ff266a9231b44a053fe95 (patch)
tree47dd5e214efaa3a28333a071c30a35895a03b5ed /lib/Support/MemoryUsage.cpp
parent0fc86ca9e28cc411cb5e00afa22c32e77aca7e57 (diff)
parent18f01e9f6d5471d176091f24671bef3eac0293ac (diff)
downloadklee-ce1dd5a7f3de7b536a9ff266a9231b44a053fe95.tar.gz
Merge pull request #344 from MartinNowack/feat_malloc
Add support for tcmalloc
Diffstat (limited to 'lib/Support/MemoryUsage.cpp')
-rw-r--r--lib/Support/MemoryUsage.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Support/MemoryUsage.cpp b/lib/Support/MemoryUsage.cpp
index 32a7eb3b..a9f4026d 100644
--- a/lib/Support/MemoryUsage.cpp
+++ b/lib/Support/MemoryUsage.cpp
@@ -11,6 +11,10 @@
 
 #include "klee/Config/config.h"
 
+#ifdef HAVE_GPERFTOOLS_MALLOC_EXTENSION_H
+#include "gperftools/malloc_extension.h"
+#endif
+
 #ifdef HAVE_MALLINFO
 #include <malloc.h>
 #endif
@@ -21,7 +25,12 @@
 using namespace klee;
 
 size_t util::GetTotalMallocUsage() {
-#ifdef HAVE_MALLINFO
+#ifdef HAVE_GPERFTOOLS_MALLOC_EXTENSION_H
+  uint64_t value;
+  MallocExtension::instance()->GetNumericProperty(
+      "generic.current_allocated_bytes", &value);
+  return value;
+#elif HAVE_MALLINFO
   struct mallinfo mi = ::mallinfo();
   // The malloc implementation in glibc (pmalloc2)
   // does not include mmap()'ed memory in mi.uordblks