Loading libmemunreachable/Allocator.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ #include "LinkedList.h" #include "anon_vma_naming.h" namespace android { // runtime interfaces used: // abort // assert - fprintf + mmap Loading Loading @@ -462,3 +464,5 @@ void Heap::deallocate(HeapImpl* impl, void* ptr) { bool Heap::empty() { return impl_->Empty(); } } // namespace android libmemunreachable/Allocator.h +5 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,9 @@ #include <unordered_map> #include <unordered_set> #include <vector> namespace android { extern std::atomic<int> heap_count; class HeapImpl; Loading Loading @@ -210,4 +213,6 @@ using set = std::set<Key, Compare, Allocator<Key>>; using string = std::basic_string<char, std::char_traits<char>, Allocator<char>>; } } // namespace android #endif libmemunreachable/HeapWalker.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ #include "ScopedSignalHandler.h" #include "log.h" namespace android { bool HeapWalker::Allocation(uintptr_t begin, uintptr_t end) { if (end == begin) { end = begin + 1; Loading Loading @@ -173,3 +175,5 @@ void HeapWalker::HandleSegFault(ScopedSignalHandler& handler, int signal, siginf } ScopedSignalHandler::SignalFn ScopedSignalHandler::handler_; } // namespace android libmemunreachable/HeapWalker.h +4 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include "ScopedSignalHandler.h" #include "Tarjan.h" namespace android { // A range [begin, end) struct Range { uintptr_t begin; Loading Loading @@ -125,4 +127,6 @@ inline void HeapWalker::ForEachAllocation(F&& f) { } } } // namespace android #endif libmemunreachable/Leak.h +5 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ namespace std { template <> struct hash<Leak::Backtrace> { std::size_t operator()(const Leak::Backtrace& key) const { struct hash<android::Leak::Backtrace> { std::size_t operator()(const android::Leak::Backtrace& key) const { std::size_t seed = 0; hash_combine(seed, key.num_frames); Loading @@ -49,9 +49,12 @@ struct hash<Leak::Backtrace> { } // namespace std namespace android { static bool operator==(const Leak::Backtrace& lhs, const Leak::Backtrace& rhs) { return (lhs.num_frames == rhs.num_frames) && memcmp(lhs.frames, rhs.frames, lhs.num_frames * sizeof(lhs.frames[0])) == 0; } } #endif Loading
libmemunreachable/Allocator.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ #include "LinkedList.h" #include "anon_vma_naming.h" namespace android { // runtime interfaces used: // abort // assert - fprintf + mmap Loading Loading @@ -462,3 +464,5 @@ void Heap::deallocate(HeapImpl* impl, void* ptr) { bool Heap::empty() { return impl_->Empty(); } } // namespace android
libmemunreachable/Allocator.h +5 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,9 @@ #include <unordered_map> #include <unordered_set> #include <vector> namespace android { extern std::atomic<int> heap_count; class HeapImpl; Loading Loading @@ -210,4 +213,6 @@ using set = std::set<Key, Compare, Allocator<Key>>; using string = std::basic_string<char, std::char_traits<char>, Allocator<char>>; } } // namespace android #endif
libmemunreachable/HeapWalker.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ #include "ScopedSignalHandler.h" #include "log.h" namespace android { bool HeapWalker::Allocation(uintptr_t begin, uintptr_t end) { if (end == begin) { end = begin + 1; Loading Loading @@ -173,3 +175,5 @@ void HeapWalker::HandleSegFault(ScopedSignalHandler& handler, int signal, siginf } ScopedSignalHandler::SignalFn ScopedSignalHandler::handler_; } // namespace android
libmemunreachable/HeapWalker.h +4 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include "ScopedSignalHandler.h" #include "Tarjan.h" namespace android { // A range [begin, end) struct Range { uintptr_t begin; Loading Loading @@ -125,4 +127,6 @@ inline void HeapWalker::ForEachAllocation(F&& f) { } } } // namespace android #endif
libmemunreachable/Leak.h +5 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ namespace std { template <> struct hash<Leak::Backtrace> { std::size_t operator()(const Leak::Backtrace& key) const { struct hash<android::Leak::Backtrace> { std::size_t operator()(const android::Leak::Backtrace& key) const { std::size_t seed = 0; hash_combine(seed, key.num_frames); Loading @@ -49,9 +49,12 @@ struct hash<Leak::Backtrace> { } // namespace std namespace android { static bool operator==(const Leak::Backtrace& lhs, const Leak::Backtrace& rhs) { return (lhs.num_frames == rhs.num_frames) && memcmp(lhs.frames, rhs.frames, lhs.num_frames * sizeof(lhs.frames[0])) == 0; } } #endif