7 #ifdef ARMNN_LEAK_CHECKING_ENABLED
16 class ScopedLeakChecker final
19 ScopedLeakChecker(
const std::string & name);
23 static bool IsActive();
28 ssize_t BytesLeaked()
const;
29 ssize_t ObjectsLeaked()
const;
35 std::unique_ptr<Impl> m_Impl;
38 ScopedLeakChecker() =
delete;
39 ScopedLeakChecker(
const ScopedLeakChecker &) =
delete;
40 ScopedLeakChecker & operator=(
const ScopedLeakChecker &) =
delete;
43 class ScopedDisableLeakChecking final
46 ScopedDisableLeakChecking();
47 ~ScopedDisableLeakChecking();
53 std::unique_ptr<Impl> m_Impl;
56 ScopedDisableLeakChecking(
const ScopedDisableLeakChecking &) =
delete;
57 ScopedDisableLeakChecking & operator=(
const ScopedDisableLeakChecking &) =
delete;
61 void LocalLeakCheckingOnly();
65 #define ARMNN_SCOPED_LEAK_CHECKER(TAG) \
66 armnnUtils::ScopedLeakChecker __scoped_armnn_leak_checker__(TAG)
68 #define ARMNN_LEAK_CHECKER_IS_ACTIVE() \
69 armnnUtils::ScopedLeakChecker::IsActive()
71 #define ARMNN_NO_LEAKS_IN_SCOPE() \
72 __scoped_armnn_leak_checker__.NoLeaks()
74 #define ARMNN_BYTES_LEAKED_IN_SCOPE() \
75 __scoped_armnn_leak_checker__.BytesLeaked()
77 #define ARMNN_OBJECTS_LEAKED_IN_SCOPE() \
78 __scoped_armnn_leak_checker__.ObjectsLeaked()
80 #define ARMNN_DISABLE_LEAK_CHECKING_IN_SCOPE() \
81 armnnUtils::ScopedDisableLeakChecking __disable_leak_checking_in_scope__
83 #define ARMNN_LOCAL_LEAK_CHECKING_ONLY() \
84 armnnUtils::LocalLeakCheckingOnly()
86 #else // ARMNN_LEAK_CHECKING_ENABLED
88 #define ARMNN_SCOPED_LEAK_CHECKER(TAG)
89 #define ARMNN_LEAK_CHECKER_IS_ACTIVE() false
90 #define ARMNN_NO_LEAKS_IN_SCOPE() true
91 #define ARMNN_BYTES_LEAKED_IN_SCOPE() 0
92 #define ARMNN_OBJECTS_LEAKED_IN_SCOPE() 0
93 #define ARMNN_DISABLE_LEAK_CHECKING_IN_SCOPE()
94 #define ARMNN_LOCAL_LEAK_CHECKING_ONLY()
96 #endif // ARMNN_LEAK_CHECKING_ENABLED