aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils/LeakChecking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnnUtils/LeakChecking.cpp')
-rw-r--r--src/armnnUtils/LeakChecking.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/armnnUtils/LeakChecking.cpp b/src/armnnUtils/LeakChecking.cpp
index ac12fe01de..83aa5d8ceb 100644
--- a/src/armnnUtils/LeakChecking.cpp
+++ b/src/armnnUtils/LeakChecking.cpp
@@ -8,6 +8,9 @@
#include "LeakChecking.hpp"
#include "gperftools/heap-checker.h"
+namespace armnnUtils
+{
+
struct ScopedLeakChecker::Impl
{
HeapLeakChecker m_LeakChecker;
@@ -59,4 +62,20 @@ ScopedDisableLeakChecking::~ScopedDisableLeakChecking()
{
}
+void LocalLeakCheckingOnly()
+{
+ auto * globalChecker = HeapLeakChecker::GlobalChecker();
+ if (globalChecker)
+ {
+ // Don't care about global leaks and make sure we won't report any.
+ // This is because leak checking supposed to run in well defined
+ // contexts through the ScopedLeakChecker, otherwise we risk false
+ // positives because of external factors.
+ globalChecker->NoGlobalLeaks();
+ globalChecker->CancelGlobalCheck();
+ }
+}
+
+} // namespace armnnUtils
+
#endif // ARMNN_LEAK_CHECKING_ENABLED