Repository navigation
CPPShift MemoryPool v2
CPPShift::Memory::MemoryPoolManager no longer present.
Right now the MemoryPool object holds all the functions to handle the memory pool data structure.
- Create a memory pool using
auto mp = new CPPShift::Memory::MemoryPool(size);orauto mp = CPPShift::Memory::MemoryPool(size); - Allocation, re-allocation and de-allocation are now
new (mp) Type[size];,mp->reallocate<Type>(pointer, size);andmp->free(pointer)respectively. - Allocate & re-allocate now have two modes: templated and general ->
mp->allocate<Type>(size);or(Type*) mp->allocate(size * sizeof(Type)), andmp->reallocate<Type>(pinter, size)or(Type*) mp->reallocate(pinter, size * sizeof(Type)). These 2 approaches to each function are actually the same. - Manage scopes using
mp->startScope()&mp->endScope() - Got slightly better performance (from a maximum of 22 time better to a maximum of 24 times better depending on OS & compiler)