ArmNN
 24.08
RefMemoryManager Class Reference

#include <RefMemoryManager.hpp>

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

Classes

class  Pool
 

Public Member Functions

 RefMemoryManager ()
 
virtual ~RefMemoryManager ()
 
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 RefMemoryManager.hpp.

Constructor & Destructor Documentation

◆ RefMemoryManager()

Definition at line 14 of file RefMemoryManager.cpp.

15 {}

◆ ~RefMemoryManager()

~RefMemoryManager ( )
virtual

Definition at line 17 of file RefMemoryManager.cpp.

18 {}

Member Function Documentation

◆ Acquire()

void Acquire ( )
overridevirtual

Implements IMemoryManager.

Definition at line 47 of file RefMemoryManager.cpp.

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

◆ Allocate()

void Allocate ( RefMemoryManager::Pool pool)

Definition at line 36 of file RefMemoryManager.cpp.

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

References ARMNN_THROW_INVALIDARG_MSG_IF_FALSE.

◆ GetPointer()

void * GetPointer ( RefMemoryManager::Pool pool)

Definition at line 42 of file RefMemoryManager.cpp.

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

References RefMemoryManager::Pool::GetPointer().

◆ Manage()

RefMemoryManager::Pool * Manage ( unsigned int  numBytes)

Definition at line 20 of file RefMemoryManager.cpp.

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

References RefMemoryManager::Pool::Reserve().

◆ Release()

void Release ( )
overridevirtual

Implements IMemoryManager.

Definition at line 55 of file RefMemoryManager.cpp.

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

Referenced by RefMemoryManager::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