ArmNN
 24.08
TosaRefMemoryManager Class Reference

#include <TosaRefMemoryManager.hpp>

Inheritance diagram for TosaRefMemoryManager:
[legend]
Collaboration diagram for TosaRefMemoryManager:
[legend]

Classes

class  Pool
 

Public Member Functions

 TosaRefMemoryManager ()
 
virtual ~TosaRefMemoryManager ()
 
PoolManage (unsigned int numBytes)
 
void Allocate (Pool *pool)
 
void * GetPointer (Pool *pool)
 
void Acquire () override
 
void Release () override
 
- Public Member Functions inherited from IMemoryManager
virtual ~IMemoryManager ()
 

Additional Inherited Members

- Protected Member Functions inherited from IMemoryManager
 IMemoryManager ()
 

Detailed Description

Definition at line 16 of file TosaRefMemoryManager.hpp.

Constructor & Destructor Documentation

◆ TosaRefMemoryManager()

Definition at line 13 of file TosaRefMemoryManager.cpp.

14 {}

◆ ~TosaRefMemoryManager()

~TosaRefMemoryManager ( )
virtual

Definition at line 16 of file TosaRefMemoryManager.cpp.

17 {}

Member Function Documentation

◆ Acquire()

void Acquire ( )
overridevirtual

Implements IMemoryManager.

Definition at line 46 of file TosaRefMemoryManager.cpp.

47 {
48  for (Pool &pool: m_Pools)
49  {
50  pool.Acquire();
51  }
52 }

◆ Allocate()

void Allocate ( TosaRefMemoryManager::Pool pool)

Definition at line 35 of file TosaRefMemoryManager.cpp.

36 {
37  ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(pool, "Null memory manager passed to TosaRefMemoryManager.");
38  m_FreePools.push_back(pool);
39 }

References ARMNN_THROW_INVALIDARG_MSG_IF_FALSE.

◆ GetPointer()

void * GetPointer ( TosaRefMemoryManager::Pool pool)

Definition at line 41 of file TosaRefMemoryManager.cpp.

42 {
43  return pool->GetPointer();
44 }

References TosaRefMemoryManager::Pool::GetPointer().

◆ Manage()

TosaRefMemoryManager::Pool * Manage ( unsigned int  numBytes)

Definition at line 19 of file TosaRefMemoryManager.cpp.

20 {
21  if (!m_FreePools.empty())
22  {
23  Pool* res = m_FreePools.back();
24  m_FreePools.pop_back();
25  res->Reserve(numBytes);
26  return res;
27  }
28  else
29  {
30  m_Pools.push_front(Pool(numBytes));
31  return &m_Pools.front();
32  }
33 }

References TosaRefMemoryManager::Pool::Reserve().

◆ Release()

void Release ( )
overridevirtual

Implements IMemoryManager.

Definition at line 54 of file TosaRefMemoryManager.cpp.

55 {
56  for (Pool &pool: m_Pools)
57  {
58  pool.Release();
59  }
60 }

Referenced by TosaRefMemoryManager::Pool::~Pool().


The documentation for this class was generated from the following files:
ARMNN_THROW_INVALIDARG_MSG_IF_FALSE
#define ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(_cond, _str)
Definition: Exceptions.hpp:210