Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
poolarrayallocator.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
16
#include "
memory/memorypool.h
"
17
18
//------------------------------------------------------------------------------
19
namespace
Memory
20
{
21
class
PoolArrayAllocator
22
{
23
public
:
25
static
const
SizeT
NumPools
= 8;
26
28
PoolArrayAllocator
();
30
~PoolArrayAllocator
();
31
33
void
Setup
(
const
char
*
name
,
Memory::HeapType
heapType
,
uint
poolSizes[
NumPools
]);
35
void
*
Alloc
(
SizeT
size);
37
void
Free
(
void
* ptr,
SizeT
size);
39
void
Free
(
void
* ptr);
41
const
MemoryPool
&
GetMemoryPool
(
IndexT
index)
const
;
42
43
#if NEBULA_MEMORY_STATS
45
void
Dump();
46
#endif
47
48
private
:
49
Memory::HeapType
heapType
;
50
const
char
*
name
;
51
MemoryPool
memoryPools
[
NumPools
];
52
};
53
54
}
// namespace Memory
55
//------------------------------------------------------------------------------
MemoryPool
A simple thread-safe memory pool.
Memory::PoolArrayAllocator::Free
void Free(void *ptr, SizeT size)
free a block of memory from the pool array with original block size
Definition
poolarrayallocator.cc:107
Memory::PoolArrayAllocator::Alloc
void * Alloc(SizeT size)
allocate a block of memory from the pool
Definition
poolarrayallocator.cc:74
Memory::PoolArrayAllocator::name
const char * name
Definition
poolarrayallocator.h:50
Memory::PoolArrayAllocator::memoryPools
MemoryPool memoryPools[NumPools]
Definition
poolarrayallocator.h:51
Memory::PoolArrayAllocator::Setup
void Setup(const char *name, Memory::HeapType heapType, uint poolSizes[NumPools])
setup the pool allocator, name must be a static string!
Definition
poolarrayallocator.cc:38
Memory::PoolArrayAllocator::heapType
Memory::HeapType heapType
Definition
poolarrayallocator.h:49
Memory::PoolArrayAllocator::~PoolArrayAllocator
~PoolArrayAllocator()
destructor
Definition
poolarrayallocator.cc:26
Memory::PoolArrayAllocator::GetMemoryPool
const MemoryPool & GetMemoryPool(IndexT index) const
access to memory pool at pool index (for debugging)
Definition
poolarrayallocator.cc:149
Memory::PoolArrayAllocator::PoolArrayAllocator
PoolArrayAllocator()
constructor
Definition
poolarrayallocator.cc:16
Memory::PoolArrayAllocator::NumPools
static const SizeT NumPools
number of pools
Definition
poolarrayallocator.h:25
memorypool.h
Memory
Definition
arenaallocator.h:31
Memory::HeapType
HeapType
Heap types are defined here.
Definition
osxmemoryconfig.h:25
SizeT
int SizeT
Definition
types.h:42
uint
unsigned int uint
Definition
types.h:33
IndexT
int IndexT
Definition
types.h:41
code
foundation
memory
poolarrayallocator.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.