diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2014-04-24 11:32:54 +0100 |
---|---|---|
committer | Martin Nowack <martin@se.inf.tu-dresden.de> | 2014-04-24 13:51:41 +0200 |
commit | e2799703b08cc1feb8a324bfb04edfeb2c296e57 (patch) | |
tree | cb58d71b3e2c3597ed169028665f74117ad4bf45 /lib/Support/MemoryUsage.cpp | |
parent | d344b98751232ea79a22c6907175154f3fc9889d (diff) | |
download | klee-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/MemoryUsage.cpp')
-rw-r--r-- | lib/Support/MemoryUsage.cpp | 8 |
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 } |