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
LIB_API void pool_free_all(Pool *p)
"free" all user allocations that ensued from the given Pool.
Definition: pool.cpp:164
#define ROUND_UP(n, multiple)
Definition: bits.h:284
size_t MaxCapacity() const
LIB_API size_t pool_committed(Pool *p)
Return the number of bytes committed in the pool's backing array.
Definition: pool.cpp:174
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:315
void * freelist
pointer to freelist (opaque); see freelist_*.
Definition: pool.h:128
void DeallocateAll()
Definition: pool.h:80
LIB_API void pool_free(Pool *p, void *el)
Make a fixed-size element available for reuse in the given Pool.
Definition: pool.cpp:146
static uintptr_t StorageAppend(Storage &storage, size_t &end, size_t size)
Definition: allocator_policies.h:319
static void * mem_freelist_Detach(void *&freelist)
Definition: freelist.h:53
LIB_API bool pool_contains(const Pool *p, void *el)
indicate whether a pointer was allocated from the given pool.
Definition: pool.cpp:108
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
Storage storage
Definition: pool.h:93
LIB_API Status pool_destroy(Pool *p)
free all memory (address space + physical) that constitutes the given Pool.
Definition: pool.cpp:98
bool Contains(uintptr_t address) const
Definition: pool.h:87
i64 Status
Error handling system.
Definition: status.h:171
#define T(string_literal)
Definition: secure_crt.cpp:76
allocator design parameters:
Definition: pool.h:114
DynArray da
Definition: pool.h:116
LIB_API void * pool_alloc(Pool *p, size_t size)
Dole out memory from the pool.
Definition: pool.cpp:120
Definition: allocator_policies.h:35
Pool(size_t maxObjects)
Definition: pool.h:51
size_t el_size
size of elements.
Definition: pool.h:122
void TestPool()
Definition: pool.cpp:76
void Deallocate(T *p)
Definition: pool.h:74
size_t end
Definition: pool.h:94
Definition: allocator_policies.h:86
void * mem_freelist_Sentinel()
Definition: freelist.cpp:26
LIB_API Status pool_create(Pool *p, size_t max_size, size_t el_size)
Ready Pool for use.
Definition: pool.cpp:86
uintptr_t Address() const
T * Allocate()
Definition: pool.h:62
static void mem_freelist_AddToFront(void *&freelist, void *el)
Definition: freelist.h:42