Go to the documentation of this file.
18 #ifndef __LIBALLOC_POOLALLOCATOR_H
19 #define __LIBALLOC_POOLALLOCATOR_H
64 const Size objectSize,
Size index
Index number in the m_pools array where this Pool is stored.
Pool * m_pools[MaximumPoolSize+1]
Array of memory pools.
virtual Size size() const
Get memory size.
const Size bitmapSize
Size in bytes of the bitmap array.
Pool * allocatePool(const uint index, const Size objectCount)
Creates a new Pool instance.
u32 signature
Filled with a fixed value to detect corruption/overflows.
u32 signature
Filled with a fixed value to detect corruption/overflows.
static const u32 ObjectSignature
Signature value is used to detect object corruption/overflows.
This data structure is prepended in memory before each object.
Pool * prev
Points to the previous pool of this size (if any).
unsigned long Address
A memory address.
Allocates same-sized objects from a contiguous block of memory.
Size calculateObjectCount(const Size objectSize) const
Calculate minimum object count for a Pool.
Appended in memory after each object.
static const Size MinimumPoolSize
Minimum power of two for a pool size.
Pool * next
Points to the next pool of this size (if any).
unsigned int uint
Unsigned integer number.
PoolAllocator::Pool Pool
Allocates same-sized objects from a contiguous block of memory.
static const Size MaximumPoolSize
Maximum power of two size a pool can be (128MiB).
struct PoolAllocator::ObjectPrefix ObjectPrefix
This data structure is prepended in memory before each object.
Size calculateObjectSize(const Size index) const
Calculate object size given the Pool index number.
virtual Size available() const
Get memory available.
Allocator * parent()
Get parent Allocator.
unsigned int u32
Unsigned 32-bit number.
unsigned int Size
Any sane size indicator cannot go negative.
Result releasePool(Pool *pool)
Release Pool instance memory.
Pool * pool
Points to the Pool instance where this object belongs to.
Pool * retrievePool(const Size inputSize)
Find a Pool of sufficient size.
Pool(const Range &range, const Size objectSize, const Size bitmapSize, u8 *bitmap)
PoolAllocator(Allocator *parent)
Constructor.
Describes a range of memory.
void calculateUsage(Size &totalSize, Size &totalUsed) const
Determine total memory usage.
Memory allocator which uses pools that each manage same-sized objects.
unsigned char u8
Unsigned 8-bit number.
virtual Result release(const Address addr)
Release memory.
virtual Result allocate(Range &args)
Allocate memory.
Result
Allocation results.
struct PoolAllocator::ObjectPostfix ObjectPostfix
Appended in memory after each object.