From 13ae5fef303a54da6d9e2a30b23c3209c0a20d45 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 12 Sep 2014 14:05:12 -0700 Subject: Add support for getting memory usage on Darwin. --- lib/Support/MemoryUsage.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/Support') 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 #endif +#ifdef HAVE_MALLOC_MALLOC_H +#include +#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 -- cgit 1.4.1