Next Previous Contents

4.14 Class AllocationPool<T, CHUNK_SIZE>

Defined in: allocpool.h

Extends: Allocator<T>

Overview: An allocation pool allocates together chunks of values of type T, instead of allocating one value at a time. This reduce the memory waste for small objects (since usually the memory actually consumed is always a multiple of 8 or 16, no matters the size of the object), and can be also quite faster.

The drawback is that the values cannot be disposed singularly. Actually, they are owned by the AllocationPool object, and are freed when the AllocationPool is disposed. Be careful to never deallocate the AllocationPool before you have finished with the objects allocated through it.


Next Previous Contents