6 #ifdef ARMNN_LEAK_CHECKING_ENABLED
9 #include "gperftools/heap-checker.h"
14 struct ScopedLeakChecker::Impl
16 HeapLeakChecker m_LeakChecker;
18 Impl(
const std::string & name)
19 : m_LeakChecker(name.c_str())
24 ScopedLeakChecker::ScopedLeakChecker(
const std::string & name)
25 : m_Impl(new Impl(name))
29 ScopedLeakChecker::~ScopedLeakChecker() {}
31 bool ScopedLeakChecker::IsActive()
33 return HeapLeakChecker::IsActive();
36 bool ScopedLeakChecker::NoLeaks()
38 return (IsActive() ? m_Impl->m_LeakChecker.NoLeaks() :
true);
41 ssize_t ScopedLeakChecker::BytesLeaked()
const
43 return (IsActive() ? m_Impl->m_LeakChecker.BytesLeaked(): 0);
46 ssize_t ScopedLeakChecker::ObjectsLeaked()
const
48 return (IsActive() ? m_Impl->m_LeakChecker.ObjectsLeaked(): 0 );
51 struct ScopedDisableLeakChecking::Impl
53 HeapLeakChecker::Disabler m_Disabler;
56 ScopedDisableLeakChecking::ScopedDisableLeakChecking()
61 ScopedDisableLeakChecking::~ScopedDisableLeakChecking()
65 void LocalLeakCheckingOnly()
67 auto * globalChecker = HeapLeakChecker::GlobalChecker();
74 globalChecker->NoGlobalLeaks();
75 globalChecker->CancelGlobalCheck();
81 #endif // ARMNN_LEAK_CHECKING_ENABLED