summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/PointerData.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-03-01 17:59:51 -0800
committerChristopher Ferris <cferris@google.com>2019-03-07 08:39:55 -0800
commit6c619a0da3f96a26d91c1db48fd3e3be156aabe5 (patch)
treeaa0802d01d19ed0891e6b77a732cc72ed5617dcc /libc/malloc_debug/PointerData.cpp
parent4e167f35d602f9dcede3b74ff3e09e88f3edb398 (diff)
Refactor the malloc_info code.
malloc_info needs to be per native allocator, but the code treated it like a global function that doesn't depend on the native memory allocator. Update malloc debug to dump the actual pointers that it has been tracking. Test: bionic-unit-tests pass. Test: malloc debug tests pass. Test: malloc hook tests pass. Change-Id: I3b0d4d748489dd84c16d16933479dc8b8d79013e Merged-In: I3b0d4d748489dd84c16d16933479dc8b8d79013e (cherry picked from commit a3656a98b10d2a4a6194a5d9705ad9c2cc5877b0)
Diffstat (limited to 'libc/malloc_debug/PointerData.cpp')
-rw-r--r--libc/malloc_debug/PointerData.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp
index 6e9d24f56..5542c1e9f 100644
--- a/libc/malloc_debug/PointerData.cpp
+++ b/libc/malloc_debug/PointerData.cpp
@@ -492,6 +492,17 @@ void PointerData::LogLeaks() {
}
}
+void PointerData::GetAllocList(std::vector<ListInfoType>* list) {
+ std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);
+ std::lock_guard<std::mutex> frame_guard(frame_mutex_);
+
+ if (pointers_.empty()) {
+ return;
+ }
+
+ GetList(list, false);
+}
+
void PointerData::GetInfo(uint8_t** info, size_t* overall_size, size_t* info_size,
size_t* total_memory, size_t* backtrace_size) {
std::lock_guard<std::mutex> pointer_guard(pointer_mutex_);