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