diff options
author | Shibin George <shibing@codeaurora.org> | 2019-05-21 12:50:10 +0530 |
---|---|---|
committer | Shibin George <shibing@codeaurora.org> | 2019-06-14 09:23:44 +0000 |
commit | b81fee767e6e91c187f619940e300ba181f871ee (patch) | |
tree | 020b7aa264a7287be4321a762052e0e7bb441de1 /libc/malloc_debug/PointerData.cpp | |
parent | 98fa5f3e216bd8f9bc51665c8ac121726421fc98 (diff) |
Avoid recording backtrace if alloc-size is outside range of interest
Steps:
1) setprop libc.debug.malloc.program <program name>
2) setprop libc.debug.malloc.options "backtrace leak_track"
3) setprop libc.debug.malloc.minalloctorecord <int> # defaults to 0
4) setprop libc.debug.malloc.maxalloctorecord <int> # defaults to SIZE_MAX
With this, backtrace recording of only those allocations which fall within
the desired range will be done.
CRs-Fixed: 2471840
Change-Id: I586dfd590e429b53e7b1b237294f0298ff7b4017
Diffstat (limited to 'libc/malloc_debug/PointerData.cpp')
-rw-r--r-- | libc/malloc_debug/PointerData.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp index 617d128c7..8cc1a2891 100644 --- a/libc/malloc_debug/PointerData.cpp +++ b/libc/malloc_debug/PointerData.cpp @@ -196,7 +196,10 @@ void PointerData::Add(const void* ptr, size_t pointer_size) { uintptr_t pointer = reinterpret_cast<uintptr_t>(ptr); size_t hash_index = 0; if (backtrace_enabled_) { - hash_index = AddBacktrace(g_debug->config().backtrace_frames()); + if ((pointer_size >= g_min_alloc_to_record) && + (pointer_size <= g_max_alloc_to_record)) { + hash_index = AddBacktrace(g_debug->config().backtrace_frames()); + } } std::lock_guard<std::mutex> pointer_guard(pointer_mutex_); |