aboutsummaryrefslogtreecommitdiff
path: root/third_party/abseil-cpp/absl/debugging/leak_check.h
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:10:54 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-10 07:10:54 +0000
commitb4807cc83ef61f2df2df63b3f440be2d74f5682a (patch)
tree2ce94d7f0804ccb77d1fa9b2a1bca00eecdff1e2 /third_party/abseil-cpp/absl/debugging/leak_check.h
parent9978f3c5c406e397901f123dfa63e8fadafb7270 (diff)
parentd3dfe74c4025bacd9741d761815a8cb059e49c68 (diff)
downloadwebrtc-android13-mainline-adbd-release.tar.gz
Snap for 8564071 from d3dfe74c4025bacd9741d761815a8cb059e49c68 to mainline-adbd-releaseaml_adb_331610000aml_adb_331314020aml_adb_331113120aml_adb_331011050aml_adb_331011040android13-mainline-adbd-release
Change-Id: I04223971ab5f2e1eb2d889c44ab1041ab0fa9123
Diffstat (limited to 'third_party/abseil-cpp/absl/debugging/leak_check.h')
-rw-r--r--third_party/abseil-cpp/absl/debugging/leak_check.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/third_party/abseil-cpp/absl/debugging/leak_check.h b/third_party/abseil-cpp/absl/debugging/leak_check.h
index 7a5a22dd1c..5fc2b052e4 100644
--- a/third_party/abseil-cpp/absl/debugging/leak_check.h
+++ b/third_party/abseil-cpp/absl/debugging/leak_check.h
@@ -43,6 +43,12 @@ ABSL_NAMESPACE_BEGIN
// currently built into this target.
bool HaveLeakSanitizer();
+// LeakCheckerIsActive()
+//
+// Returns true if a leak-checking sanitizer (either ASan or standalone LSan) is
+// currently built into this target and is turned on.
+bool LeakCheckerIsActive();
+
// DoIgnoreLeak()
//
// Implements `IgnoreLeak()` below. This function should usually
@@ -62,7 +68,8 @@ void DoIgnoreLeak(const void* ptr);
//
// If the passed `ptr` does not point to an actively allocated object at the
// time `IgnoreLeak()` is called, the call is a no-op; if it is actively
-// allocated, the object must not get deallocated later.
+// allocated, leak sanitizer will assume this object is referenced even if
+// there is no actual reference in user memory.
//
template <typename T>
T* IgnoreLeak(T* ptr) {
@@ -70,6 +77,19 @@ T* IgnoreLeak(T* ptr) {
return ptr;
}
+// FindAndReportLeaks()
+//
+// If any leaks are detected, prints a leak report and returns true. This
+// function may be called repeatedly, and does not affect end-of-process leak
+// checking.
+//
+// Example:
+// if (FindAndReportLeaks()) {
+// ... diagnostic already printed. Exit with failure code.
+// exit(1)
+// }
+bool FindAndReportLeaks();
+
// LeakCheckDisabler
//
// This helper class indicates that any heap allocations done in the code block