ArmNN
 22.11
TosaRefMemoryManager Class Reference

#include <TosaRefMemoryManager.hpp>

Inheritance diagram for TosaRefMemoryManager:
IMemoryManager

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 14 of file TosaRefMemoryManager.cpp.

15 {}

◆ ~TosaRefMemoryManager()

~TosaRefMemoryManager ( )
virtual

Definition at line 17 of file TosaRefMemoryManager.cpp.

18 {}

Member Function Documentation

◆ Acquire()

void Acquire ( )
overridevirtual

Implements IMemoryManager.

Definition at line 47 of file TosaRefMemoryManager.cpp.

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

◆ Allocate()

void Allocate ( TosaRefMemoryManager::Pool pool)

Definition at line 36 of file TosaRefMemoryManager.cpp.

References ARMNN_ASSERT.

37 {
38  ARMNN_ASSERT(pool);
39  m_FreePools.push_back(pool);
40 }
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14

◆ GetPointer()

void * GetPointer ( TosaRefMemoryManager::Pool pool)

Definition at line 42 of file TosaRefMemoryManager.cpp.

References TosaRefMemoryManager::Pool::GetPointer().

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

◆ Manage()

TosaRefMemoryManager::Pool * Manage ( unsigned int  numBytes)

Definition at line 20 of file TosaRefMemoryManager.cpp.

References TosaRefMemoryManager::Pool::Reserve().

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 }

◆ Release()

void Release ( )
overridevirtual

Implements IMemoryManager.

Definition at line 55 of file TosaRefMemoryManager.cpp.

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

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