about summary refs log tree commit diff homepage
path: root/lib/Support
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2014-04-24 11:32:54 +0100
committerMartin Nowack <martin@se.inf.tu-dresden.de>2014-04-24 13:51:41 +0200
commite2799703b08cc1feb8a324bfb04edfeb2c296e57 (patch)
treecb58d71b3e2c3597ed169028665f74117ad4bf45 /lib/Support
parentd344b98751232ea79a22c6907175154f3fc9889d (diff)
downloadklee-e2799703b08cc1feb8a324bfb04edfeb2c296e57.tar.gz
Modify klee::util::GetTotalMemoryUsage() so that if the system is
not using glibc the malloc usage if computed differently.
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/MemoryUsage.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Support/MemoryUsage.cpp b/lib/Support/MemoryUsage.cpp
index 1bdff819..94cee79e 100644
--- a/lib/Support/MemoryUsage.cpp
+++ b/lib/Support/MemoryUsage.cpp
@@ -13,7 +13,13 @@
 using namespace klee;
 
 size_t util::GetTotalMemoryUsage() {
-  // This is linux platform specific
   struct mallinfo mi = ::mallinfo();
+  // The malloc implementation in glibc (pmalloc2)
+  // does not include mmap()'ed memory in mi.uordblks
+  // but other implementations (e.g. tcmalloc) do.
+#if defined(__GLIBC__)
   return mi.uordblks + mi.hblkhd;
+#else
+  return mi.uordblks;
+#endif
 }