diff options
author | Frank Busse <bb0xfb@gmail.com> | 2022-03-18 09:06:48 +0000 |
---|---|---|
committer | MartinNowack <2443641+MartinNowack@users.noreply.github.com> | 2022-04-25 18:13:56 +0100 |
commit | 33bac31837938c0fdc143022ae8498beb57510a8 (patch) | |
tree | d8018c568ae1d44599504500ed86b624468582c8 /lib/Support/MemoryUsage.cpp | |
parent | ee94e78a5bde3b491282db7acf1620c224119459 (diff) | |
download | klee-33bac31837938c0fdc143022ae8498beb57510a8.tar.gz |
use mallinfo2 if available
Diffstat (limited to 'lib/Support/MemoryUsage.cpp')
-rw-r--r-- | lib/Support/MemoryUsage.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Support/MemoryUsage.cpp b/lib/Support/MemoryUsage.cpp index 6e9f9424..5878939e 100644 --- a/lib/Support/MemoryUsage.cpp +++ b/lib/Support/MemoryUsage.cpp @@ -16,7 +16,7 @@ #include "gperftools/malloc_extension.h" #endif -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) #include <malloc.h> #endif #ifdef HAVE_MALLOC_ZONE_STATISTICS @@ -96,6 +96,10 @@ size_t util::GetTotalMallocUsage() { MallocExtension::instance()->GetNumericProperty( "generic.current_allocated_bytes", &value); return value; +#elif defined(HAVE_MALLINFO2) + // niy in tcmalloc + struct mallinfo2 mi = ::mallinfo2(); + return mi.uordblks + mi.hblkhd; #elif defined(HAVE_MALLINFO) struct mallinfo mi = ::mallinfo(); // The malloc implementation in glibc (pmalloc2) |