MergedAllocation

Allows to merge the allocation of several arrays, which saves allocation count and can speed up things thanks to locality.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

alloc
void alloc(T* array, size_t numElems, size_t alignment)

Given pointer base, array gets an alignement area with numElems T elements and a given alignment. base gets incremented to point to just after that area. This is usful to create merged allocations with a chain of mergedAllocArea. Giving null to this chain and converting the result to size_t give the total needed size for the merged allocation. Warning: if called after a start() call, the area returned are wrong and are only for counting needed bytes. if called after an allocate() call, the area returned are right (if the same calls are done).

allocArray
void allocArray(T[] array, size_t numElems, size_t alignment)

Given pointer base, array gets an alignement area with numElems T elements and a given alignment. base gets incremented to point to just after that area. This is usful to create merged allocations with a chain of mergedAllocArea. Giving null to this chain and converting the result to size_t give the total needed size for the merged allocation. Warning: if called after a start() call, the area returned are wrong and are only for counting needed bytes. if called after an allocate() call, the area returned are right (if the same calls are done).

allocate
void allocate()

Allocate actual storage for the merged allocation. From there, you need to define exactly the same area with alloc and allocArray. This time they will get a proper value.

start
void start()

Start defining the area of allocations.

Manifest constants

maxExpectedAlignment
enum maxExpectedAlignment;
Undocumented in source.

Examples

see below unittest.

Meta