diff options
author | Chris Lattner <sabre@nondot.org> | 2005-11-14 07:27:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-11-14 07:27:56 +0000 |
commit | 16cbc6a17733a81c0ddbff73bafaf888d2e067fb (patch) | |
tree | 1e1d2a3e90018a293ff91a158b8a0f5afff98ffa /llvm/lib/System/Unix/Process.inc | |
parent | 8147902625c75dc8f34e001131292893180c30f7 (diff) | |
download | bcm5719-llvm-16cbc6a17733a81c0ddbff73bafaf888d2e067fb.tar.gz bcm5719-llvm-16cbc6a17733a81c0ddbff73bafaf888d2e067fb.zip |
instead of using mstats, use malloc_zone_statistics which returns numbers
that actually make sense.
llvm-svn: 24352
Diffstat (limited to 'llvm/lib/System/Unix/Process.inc')
-rw-r--r-- | llvm/lib/System/Unix/Process.inc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/System/Unix/Process.inc b/llvm/lib/System/Unix/Process.inc index f73444f0c05..32733d61366 100644 --- a/llvm/lib/System/Unix/Process.inc +++ b/llvm/lib/System/Unix/Process.inc @@ -51,8 +51,10 @@ size_t Process::GetMallocUsage() { struct mallinfo mi; mi = ::mallinfo(); return mi.uordblks; -#elif defined(HAVE_MSTATS) && defined(HAVE_MALLOC_MALLOC_H) - return mstats().bytes_used; // darwin +#elif defined(HAVE_MALLOC_ZONE_STATISTICS) && defined(HAVE_MALLOC_MALLOC_H) + malloc_statistics_t Stats; + malloc_zone_statistics(malloc_default_zone(), &Stats); + return Stats.size_in_use; // darwin #elif defined(HAVE_SBRK) // Note this is only an approximation and more closely resembles // the value returned by mallinfo in the arena field. @@ -74,8 +76,10 @@ Process::GetTotalMemoryUsage() #if defined(HAVE_MALLINFO) struct mallinfo mi = ::mallinfo(); return mi.uordblks + mi.hblkhd; -#elif defined(HAVE_MSTATS) && defined(HAVE_MALLOC_MALLOC_H) - return mstats().bytes_total; // darwin +#elif defined(HAVE_MALLOC_ZONE_STATISTICS) && defined(HAVE_MALLOC_MALLOC_H) + malloc_statistics_t Stats; + malloc_zone_statistics(malloc_default_zone(), &Stats); + return Stats.size_allocated; // darwin #elif defined(HAVE_GETRUSAGE) struct rusage usage; ::getrusage(RUSAGE_SELF, &usage); |