[llvm-commits] CVS: llvm/lib/System/Unix/Process.inc
Chris Lattner
lattner at cs.uiuc.edu
Sun Nov 13 23:28:08 PST 2005
Changes in directory llvm/lib/System/Unix:
Process.inc updated: 1.12 -> 1.13
---
Log message:
instead of using mstats, use malloc_zone_statistics which returns numbers
that actually make sense.
---
Diffs of the changes: (+8 -4)
Process.inc | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
Index: llvm/lib/System/Unix/Process.inc
diff -u llvm/lib/System/Unix/Process.inc:1.12 llvm/lib/System/Unix/Process.inc:1.13
--- llvm/lib/System/Unix/Process.inc:1.12 Mon Nov 14 01:00:29 2005
+++ llvm/lib/System/Unix/Process.inc Mon Nov 14 01:27:56 2005
@@ -51,8 +51,10 @@
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 @@
#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);
More information about the llvm-commits
mailing list