ArmNN
 24.02
TosaRefMemoryManager::Pool Class Reference

#include <TosaRefMemoryManager.hpp>

Public Member Functions

 Pool (unsigned int numBytes)
 
 ~Pool ()
 
void Acquire ()
 
void Release ()
 
void * GetPointer ()
 
void Reserve (unsigned int numBytes)
 

Detailed Description

Definition at line 33 of file TosaRefMemoryManager.hpp.

Constructor & Destructor Documentation

◆ Pool()

Pool ( unsigned int  numBytes)

Definition at line 63 of file TosaRefMemoryManager.cpp.

64  : m_Size(numBytes),
65  m_Pointer(nullptr)
66 {}

◆ ~Pool()

~Pool ( )

Definition at line 68 of file TosaRefMemoryManager.cpp.

69 {
70  if (m_Pointer)
71  {
72  Release();
73  }
74 }

References TosaRefMemoryManager::Release().

Member Function Documentation

◆ Acquire()

void Acquire ( )

Definition at line 88 of file TosaRefMemoryManager.cpp.

89 {
90  ARMNN_ASSERT_MSG(!m_Pointer, "TosaRefMemoryManager::Pool::Acquire() called when memory already acquired");
91  m_Pointer = ::operator new(size_t(m_Size));
92 }

References ARMNN_ASSERT_MSG.

◆ GetPointer()

void * GetPointer ( )

Definition at line 76 of file TosaRefMemoryManager.cpp.

77 {
78  ARMNN_ASSERT_MSG(m_Pointer, "TosaRefMemoryManager::Pool::GetPointer() called when memory not acquired");
79  return m_Pointer;
80 }

References ARMNN_ASSERT_MSG.

Referenced by TosaRefMemoryManager::GetPointer().

◆ Release()

void Release ( )

Definition at line 94 of file TosaRefMemoryManager.cpp.

95 {
96  ARMNN_ASSERT_MSG(m_Pointer, "TosaRefMemoryManager::Pool::Release() called when memory not acquired");
97  ::operator delete(m_Pointer);
98  m_Pointer = nullptr;
99 }

References ARMNN_ASSERT_MSG.

◆ Reserve()

void Reserve ( unsigned int  numBytes)

Definition at line 82 of file TosaRefMemoryManager.cpp.

83 {
84  ARMNN_ASSERT_MSG(!m_Pointer, "TosaRefMemoryManager::Pool::Reserve() cannot be called after memory acquired");
85  m_Size = std::max(m_Size, numBytes);
86 }

References ARMNN_ASSERT_MSG.

Referenced by TosaRefMemoryManager::Manage().


The documentation for this class was generated from the following files:
ARMNN_ASSERT_MSG
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
armnn::TosaRefMemoryManager::Pool::Release
void Release()
Definition: TosaRefMemoryManager.cpp:94