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