From e2799703b08cc1feb8a324bfb04edfeb2c296e57 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Thu, 24 Apr 2014 11:32:54 +0100 Subject: Modify klee::util::GetTotalMemoryUsage() so that if the system is not using glibc the malloc usage if computed differently. --- lib/Support/MemoryUsage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/Support') 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 } -- cgit 1.4.1