27#ifndef INCLUDED_ALLOCATORS_POOL
28#define INCLUDED_ALLOCATORS_POOL
50template<
typename T,
class Storage = Storage_Fixed<> >
#define ROUND_UP(n, multiple)
Definition: bits.h:143
allocator design parameters:
Definition: pool.h:52
Pool(size_t maxObjects)
Definition: pool.h:58
size_t end
Definition: pool.h:101
void Deallocate(T *p)
Definition: pool.h:81
void * freelist
Definition: pool.h:102
bool Contains(uintptr_t address) const
Definition: pool.h:94
void DeallocateAll()
Definition: pool.h:87
size_t RemainingObjects()
Definition: pool.h:64
T * Allocate()
Definition: pool.h:69
static const size_t objectSize
Definition: pool.h:56
Storage storage
Definition: pool.h:100
#define ASSERT(expr)
same as ENSURE in debug mode, does nothing in release mode.
Definition: debug.h:250
void * mem_freelist_Sentinel()
Definition: freelist.cpp:26
static void * mem_freelist_Detach(void *&freelist)
Definition: freelist.h:57
static void mem_freelist_AddToFront(void *&freelist, void *el)
Definition: freelist.h:46
Definition: allocator_policies.h:42
static uintptr_t StorageAppend(Storage &storage, size_t &end, size_t size)
Definition: allocator_policies.h:326
void TestPool()
Definition: pool.cpp:76
void pool_free(Pool *p, void *el)
Make a fixed-size element available for reuse in the given Pool.
Definition: pool.cpp:142
bool pool_contains(const Pool *p, void *el)
indicate whether a pointer was allocated from the given pool.
Definition: pool.cpp:105
void * pool_alloc(Pool *p, size_t size)
Dole out memory from the pool.
Definition: pool.cpp:117
Status pool_create(Pool *p, size_t max_size, size_t el_size)
Ready Pool for use.
Definition: pool.cpp:83
void pool_free_all(Pool *p)
"free" all user allocations that ensued from the given Pool.
Definition: pool.cpp:160
Status pool_destroy(Pool *p)
free all memory (address space + physical) that constitutes the given Pool.
Definition: pool.cpp:95
size_t pool_committed(Pool *p)
Return the number of bytes committed in the pool's backing array.
Definition: pool.cpp:170
const size_t POOL_VARIABLE_ALLOCS
pass as pool_create's <el_size> param to indicate variable-sized allocs are required (see below).
Definition: pool.h:142
#define T(string_literal)
Definition: secure_crt.cpp:81
std::int64_t Status
Error handling system.
Definition: status.h:174
Definition: allocator_policies.h:94
size_t MaxCapacity() const
uintptr_t Address() const
provides a memory range that can be expanded but doesn't waste physical memory or relocate itself.
Definition: dynarray.h:42
allocator design parameters:
Definition: pool.h:122
size_t el_size
size of elements.
Definition: pool.h:129
void * freelist
pointer to freelist (opaque); see freelist_*.
Definition: pool.h:135
DynArray da
Definition: pool.h:123