ArmNN
 24.08
RefMemoryManager::Pool Class Reference

#include <RefMemoryManager.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 RefMemoryManager.hpp.

Constructor & Destructor Documentation

◆ Pool()

Pool ( unsigned int  numBytes)

Definition at line 63 of file RefMemoryManager.cpp.

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

◆ ~Pool()

~Pool ( )

Definition at line 68 of file RefMemoryManager.cpp.

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

References RefMemoryManager::Release().

Member Function Documentation

◆ Acquire()

void Acquire ( )

Definition at line 90 of file RefMemoryManager.cpp.

91 {
92  ARMNN_THROW_MSG_IF_FALSE(!m_Pointer, RuntimeException,
93  "RefMemoryManager::Pool::Acquire() called when memory already acquired");
94  m_Pointer = ::operator new(size_t(m_Size));
95 }

References ARMNN_THROW_MSG_IF_FALSE.

◆ GetPointer()

void * GetPointer ( )

Definition at line 76 of file RefMemoryManager.cpp.

77 {
78  ARMNN_THROW_MSG_IF_FALSE(m_Pointer, RuntimeException,
79  "RefMemoryManager::Pool::GetPointer() called when memory not acquired");
80  return m_Pointer;
81 }

References ARMNN_THROW_MSG_IF_FALSE.

Referenced by RefMemoryManager::GetPointer().

◆ Release()

void Release ( )

Definition at line 97 of file RefMemoryManager.cpp.

98 {
99  ARMNN_THROW_MSG_IF_FALSE(m_Pointer, RuntimeException,
100  "RefMemoryManager::Pool::Release() called when memory not acquired");
101  ::operator delete(m_Pointer);
102  m_Pointer = nullptr;
103 }

References ARMNN_THROW_MSG_IF_FALSE.

◆ Reserve()

void Reserve ( unsigned int  numBytes)

Definition at line 83 of file RefMemoryManager.cpp.

84 {
85  ARMNN_THROW_MSG_IF_FALSE(!m_Pointer, RuntimeException,
86  "RefMemoryManager::Pool::Reserve() cannot be called after memory acquired");
87  m_Size = std::max(m_Size, numBytes);
88 }

References ARMNN_THROW_MSG_IF_FALSE.

Referenced by RefMemoryManager::Manage().


The documentation for this class was generated from the following files:
armnn::RefMemoryManager::Pool::Release
void Release()
Definition: RefMemoryManager.cpp:97
ARMNN_THROW_MSG_IF_FALSE
#define ARMNN_THROW_MSG_IF_FALSE(_cond, _except, _str)
Definition: Exceptions.hpp:206