27#ifndef INCLUDED_ALLOCATORS_POOL
28#define INCLUDED_ALLOCATORS_POOL
43template<
typename T,
class Storage = Storage_Fixed<> >
#define ROUND_UP(n, multiple)
Definition: bits.h:284
allocator design parameters:
Definition: pool.h:45
Pool(size_t maxObjects)
Definition: pool.h:51
size_t end
Definition: pool.h:94
void Deallocate(T *p)
Definition: pool.h:74
void * freelist
Definition: pool.h:95
bool Contains(uintptr_t address) const
Definition: pool.h:87
void DeallocateAll()
Definition: pool.h:80
size_t RemainingObjects()
Definition: pool.h:57
T * Allocate()
Definition: pool.h:62
static const size_t objectSize
Definition: pool.h:49
Storage storage
Definition: pool.h:93
#define ASSERT(expr)
same as ENSURE in debug mode, does nothing in release mode.
Definition: debug.h:305
void * mem_freelist_Sentinel()
Definition: freelist.cpp:26
static void * mem_freelist_Detach(void *&freelist)
Definition: freelist.h:55
static void mem_freelist_AddToFront(void *&freelist, void *el)
Definition: freelist.h:44
Definition: allocator_policies.h:36
static uintptr_t StorageAppend(Storage &storage, size_t &end, size_t size)
Definition: allocator_policies.h:320
void TestPool()
Definition: pool.cpp:75
void pool_free(Pool *p, void *el)
Make a fixed-size element available for reuse in the given Pool.
Definition: pool.cpp:145
bool pool_contains(const Pool *p, void *el)
indicate whether a pointer was allocated from the given pool.
Definition: pool.cpp:107
void * pool_alloc(Pool *p, size_t size)
Dole out memory from the pool.
Definition: pool.cpp:119
Status pool_create(Pool *p, size_t max_size, size_t el_size)
Ready Pool for use.
Definition: pool.cpp:85
void pool_free_all(Pool *p)
"free" all user allocations that ensued from the given Pool.
Definition: pool.cpp:163
Status pool_destroy(Pool *p)
free all memory (address space + physical) that constitutes the given Pool.
Definition: pool.cpp:97
size_t pool_committed(Pool *p)
Return the number of bytes committed in the pool's backing array.
Definition: pool.cpp:173
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:135
#define T(string_literal)
Definition: secure_crt.cpp:77
i64 Status
Error handling system.
Definition: status.h:173
Definition: allocator_policies.h:88
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:40
allocator design parameters:
Definition: pool.h:115
size_t el_size
size of elements.
Definition: pool.h:122
void * freelist
pointer to freelist (opaque); see freelist_*.
Definition: pool.h:128
DynArray da
Definition: pool.h:116