diff --git a/libmemunreachable/HeapWalker.cpp b/libmemunreachable/HeapWalker.cpp index faa6fe2b2..62366f2ef 100644 --- a/libmemunreachable/HeapWalker.cpp +++ b/libmemunreachable/HeapWalker.cpp @@ -41,11 +41,13 @@ bool HeapWalker::Allocation(uintptr_t begin, uintptr_t end) { return true; } else { Range overlap = inserted.first->first; - ALOGE("range %p-%p overlaps with existing range %p-%p", - reinterpret_cast(begin), - reinterpret_cast(end), - reinterpret_cast(overlap.begin), - reinterpret_cast(overlap.end)); + if (overlap != range) { + ALOGE("range %p-%p overlaps with existing range %p-%p", + reinterpret_cast(begin), + reinterpret_cast(end), + reinterpret_cast(overlap.begin), + reinterpret_cast(overlap.end)); + } return false; } } diff --git a/libmemunreachable/HeapWalker.h b/libmemunreachable/HeapWalker.h index 140f3eaa0..3c1b513c1 100644 --- a/libmemunreachable/HeapWalker.h +++ b/libmemunreachable/HeapWalker.h @@ -31,6 +31,12 @@ struct Range { uintptr_t end; size_t size() const { return end - begin; }; + bool operator==(const Range& other) const { + return this->begin == other.begin && this->end == other.end; + } + bool operator!=(const Range& other) const { + return !(*this == other); + } }; // Comparator for Ranges that returns equivalence for overlapping ranges