ArmNN
 24.08
SampleMemoryManager Class Reference

#include <SampleMemoryManager.hpp>

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

Classes

class  Pool
 

Public Member Functions

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

Constructor & Destructor Documentation

◆ SampleMemoryManager()

Definition at line 13 of file SampleMemoryManager.cpp.

14 {}

◆ ~SampleMemoryManager()

~SampleMemoryManager ( )
virtual

Definition at line 16 of file SampleMemoryManager.cpp.

17 {}

Member Function Documentation

◆ Acquire()

void Acquire ( )
overridevirtual

Implements IMemoryManager.

Definition at line 45 of file SampleMemoryManager.cpp.

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

◆ Allocate()

void Allocate ( SampleMemoryManager::Pool pool)

Definition at line 35 of file SampleMemoryManager.cpp.

36 {
37  m_FreePools.push_back(pool);
38 }

◆ GetPointer()

void * GetPointer ( SampleMemoryManager::Pool pool)

Definition at line 40 of file SampleMemoryManager.cpp.

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

References SampleMemoryManager::Pool::GetPointer().

◆ Manage()

SampleMemoryManager::Pool * Manage ( unsigned int  numBytes)

Definition at line 19 of file SampleMemoryManager.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 SampleMemoryManager::Pool::Reserve().

◆ Release()

void Release ( )
overridevirtual

Implements IMemoryManager.

Definition at line 53 of file SampleMemoryManager.cpp.

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

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


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