summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_malloc_mac.cc
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2012-09-12 15:29:50 +0000
committerAlexander Potapenko <glider@google.com>2012-09-12 15:29:50 +0000
commitf3a96894a605534bf8ed3d134f139d3a67e7aace (patch)
treeccab68a432e504ec375cb1d28a3443fcea559da1 /compiler-rt/lib/asan/asan_malloc_mac.cc
parent10a448d45aa429548b00e99a3f165c5ac3593b94 (diff)
downloadbcm5719-llvm-f3a96894a605534bf8ed3d134f139d3a67e7aace.tar.gz
bcm5719-llvm-f3a96894a605534bf8ed3d134f139d3a67e7aace.zip
Give more accurate malloc statistics to malloc_zone_statistics().
Fix a warning in macros instantiation. llvm-svn: 163716
Diffstat (limited to 'compiler-rt/lib/asan/asan_malloc_mac.cc')
-rw-r--r--compiler-rt/lib/asan/asan_malloc_mac.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler-rt/lib/asan/asan_malloc_mac.cc b/compiler-rt/lib/asan/asan_malloc_mac.cc
index 0243bf99149..5cd63304ebf 100644
--- a/compiler-rt/lib/asan/asan_malloc_mac.cc
+++ b/compiler-rt/lib/asan/asan_malloc_mac.cc
@@ -25,6 +25,8 @@
#include "asan_mac.h"
#include "asan_report.h"
#include "asan_stack.h"
+#include "asan_stats.h"
+#include "asan_thread_registry.h"
// Similar code is used in Google Perftools,
// http://code.google.com/p/google-perftools.
@@ -276,7 +278,6 @@ void mz_free_definite_size(malloc_zone_t* zone, void *ptr, size_t size) {
#endif
#endif
-// malloc_introspection callbacks. I'm not clear on what all of these do.
kern_return_t mi_enumerator(task_t task, void *,
unsigned type_mask, vm_address_t zone_address,
memory_reader_t reader,
@@ -313,11 +314,10 @@ void mi_force_unlock(malloc_zone_t *zone) {
}
void mi_statistics(malloc_zone_t *zone, malloc_statistics_t *stats) {
- // TODO(glider): fill these correctly.
- stats->blocks_in_use = 0;
- stats->size_in_use = 0;
- stats->max_size_in_use = 0;
- stats->size_allocated = 0;
+ AsanMallocStats malloc_stats;
+ asanThreadRegistry().FillMallocStatistics(&malloc_stats);
+ CHECK(sizeof(malloc_statistics_t) == sizeof(AsanMallocStats));
+ internal_memcpy(stats, &malloc_stats, sizeof(malloc_statistics_t));
}
#if defined(MAC_OS_X_VERSION_10_6) && \
OpenPOWER on IntegriCloud