Allocator
Custom allocator library.
More...
|
Data Structures |
struct | lass::util::impl::IsCompatibleAllocator< Allocator, AllocatorFun > |
struct | lass::util::impl::IsFixedAllocator< Allocator > |
struct | lass::util::impl::IsVariableAllocator< Allocator > |
class | lass::util::AllocatorClassAdaptor< VariableAllocator, destructionPriority > |
| Use an Allocator to implement a class' new and delete
Derive from this class to implement new and delete based on Allocator. More...
|
class | lass::util::AllocatorMalloc |
class | lass::util::AllocatorLocked< Allocator, Lock, Locker > |
| Guard a MT unsafe allocator with some lock. More...
|
class | lass::util::AllocatorPerThread< Allocator > |
| Instantiates an Allocator per thread. More...
|
class | lass::util::AllocatorVariable< FixedAllocator > |
| A variable-size allocator built on top of a fixed-size allocator. More...
|
struct | lass::util::BinnerOne |
struct | lass::util::BinnerPower2 |
struct | lass::util::BinnerPadded< multiple > |
class | lass::util::AllocatorBinned< FixedAllocator, maxBinSize, Binner, VariableAllocator > |
class | lass::util::AllocatorStaticFixed< FixedAllocator, size > |
class | lass::util::AllocatorThrow< Allocator > |
class | lass::util::AllocatorNoThrow< Allocator > |
class | lass::util::AllocatorSingleton< VariableAllocator, destructionPriority > |
class | lass::util::AllocatorStats< Allocator > |
class | lass::util::AllocatorFreeList< FixedAllocator > |
| A fixed-size free-list allocator. More...
|
class | lass::util::AllocatorConcurrentFreeList< FixedAllocator > |
| A fixed-size lock-free free-list allocator. More...
|
class | lass::util::AllocatorSimpleBlock< requestedBlockSize, FixedAllocator > |
| A simple fixed-size block allocator. More...
|
class | lass::util::AllocatorAligned< alignment, VariableAllocator > |
class | lass::util::AllocatorSized< VariableAllocator > |
Detailed Description
Custom allocator library.
This library provides a nice flexible set of custom allocators you can combine in anyway you like, as long as it makes sense.
There are in general two kind of allocator concepts: fixed-size and variable-size allocators, with the obvious meanings. The former is constructed with the requested block size and (de)allocates blocks of at least that size. The latter has a default constructor and the requested block size is passed at _both_ allocation and deallocation. Some variable-size allocators (like AllocatorMalloc) also provide deallocate(void* mem) without the block size, but that's not a requirement.
class FixedSizeAllocator
{
public:
FixedSizeAllocator(size_t size);
void* allocate();
void deallocate(void* mem);
};
class VariableSizeAllocator
{
VariableSizeAllocator();
void* allocate(size_t size);
void deallocate(void* mem, size_t size);
};
There are bottom-level allocators (like AllocatorMalloc) that do real allocation work and exist on there own. And there are adaptor allocators (like AllocatorLocked) that extend/adapt another allocator to provide some extra functionality. Some of them (like AllocatorLocked) implement both the fixed-size and variable-size concept. Others (like AllocatorVariableSize) convert a fixed-size interface to variable-size.
On top of all that, there's AllocatorClassAdaptor you can use to overload class-specific new and delete using a variable-size allocator.