diff options
author | Daniel Dunbar <daniel@zuster.org> | 2014-09-12 14:05:12 -0700 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2014-09-12 17:39:17 -0700 |
commit | 13ae5fef303a54da6d9e2a30b23c3209c0a20d45 (patch) | |
tree | 2e3e35e94be98a4a0777abd83f9c70034820d5a8 /lib/Support/MemoryUsage.cpp | |
parent | 4444e21e7926ca079583f14a51cca0bf5e01b711 (diff) | |
download | klee-13ae5fef303a54da6d9e2a30b23c3209c0a20d45.tar.gz |
Add support for getting memory usage on Darwin.
Diffstat (limited to 'lib/Support/MemoryUsage.cpp')
-rw-r--r-- | lib/Support/MemoryUsage.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Support/MemoryUsage.cpp b/lib/Support/MemoryUsage.cpp index 6143b127..32a7eb3b 100644 --- a/lib/Support/MemoryUsage.cpp +++ b/lib/Support/MemoryUsage.cpp @@ -14,6 +14,9 @@ #ifdef HAVE_MALLINFO #include <malloc.h> #endif +#ifdef HAVE_MALLOC_MALLOC_H +#include <malloc/malloc.h> +#endif using namespace klee; @@ -29,6 +32,13 @@ size_t util::GetTotalMallocUsage() { return mi.uordblks; #endif +#elif defined(HAVE_MALLOC_ZONE_STATISTICS) && defined(HAVE_MALLOC_MALLOC_H) + + // Support memory usage on Darwin. + malloc_statistics_t Stats; + malloc_zone_statistics(malloc_default_zone(), &Stats); + return Stats.size_in_use; + #else // HAVE_MALLINFO #warning Cannot get malloc info on this platform |