ArmNN
 25.11
Loading...
Searching...
No Matches
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 62 of file TosaRefMemoryManager.cpp.

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

◆ ~Pool()

~Pool ( )

Definition at line 67 of file TosaRefMemoryManager.cpp.

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

References TosaRefMemoryManager::Release().

Member Function Documentation

◆ Acquire()

void Acquire ( )

Definition at line 89 of file TosaRefMemoryManager.cpp.

90{
91 ARMNN_THROW_MSG_IF_FALSE(!m_Pointer, RuntimeException,
92 "TosaRefMemoryManager::Pool::Acquire() called when memory already acquired");
93 m_Pointer = ::operator new(size_t(m_Size));
94}
#define ARMNN_THROW_MSG_IF_FALSE(_cond, _except, _str)

References ARMNN_THROW_MSG_IF_FALSE.

◆ GetPointer()

void * GetPointer ( )

Definition at line 75 of file TosaRefMemoryManager.cpp.

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

References ARMNN_THROW_MSG_IF_FALSE.

Referenced by TosaRefMemoryManager::GetPointer().

◆ Release()

void Release ( )

Definition at line 96 of file TosaRefMemoryManager.cpp.

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

References ARMNN_THROW_MSG_IF_FALSE.

◆ Reserve()

void Reserve ( unsigned int numBytes)

Definition at line 82 of file TosaRefMemoryManager.cpp.

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

References ARMNN_THROW_MSG_IF_FALSE.

Referenced by TosaRefMemoryManager::Manage().


The documentation for this class was generated from the following files: