#include <SmallObj.h>
Inheritance diagram for Loki::SmallObjectBase< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >:
Public Types | |
typedef AllocatorSingleton< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy > | ObjAllocatorSingleton |
Static Public Member Functions | |
static void * | operator new (std::size_t size) throw ( std::bad_alloc ) |
Throwing single-object new throws bad_alloc when allocation fails. | |
static void * | operator new (std::size_t size, const std::nothrow_t &) throw () |
Non-throwing single-object new returns NULL if allocation fails. | |
static void * | operator new (std::size_t size, void *place) |
Placement single-object new merely calls global placement new. | |
static void | operator delete (void *p, std::size_t size) throw () |
Single-object delete. | |
static void | operator delete (void *p, const std::nothrow_t &) throw () |
static void | operator delete (void *p, void *place) |
Placement single-object delete merely calls global placement delete. |
The lifetime policies recommended for use with Small-Objects hosted by a SingletonHolder template are
The default lifetime of Small-Objects is LongevityLifetime::DieAsSmallObjectParent to insure that memory is not released before a object with the lifetime LongevityLifetime::DieAsSmallObjectChild using that memory is destroyed. The LongevityLifetime::DieAsSmallObjectParent lifetime has the highest possible value of a SetLongevity lifetime, so you can use it in combination with your own lifetime not having also the highest possible value.
The DefaultLifetime and PhoenixSingleton policies are *not* recommended since they can cause the allocator to be destroyed and release memory for singletons hosting a object which inherit from either SmallObject or SmallValueObject.
You should *not* use NoDestroy for the singleton, and then use SingletonWithLongevity for the Small-Object.
typedef AllocatorSingleton< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy > Loki::SmallObjectBase< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::ObjAllocatorSingleton |
Defines type of allocator singleton, must be public to handle singleton lifetime dependencies.
static void Loki::SmallObjectBase< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::operator delete | ( | void * | p, | |
const std::nothrow_t & | ||||
) | throw () [inline, static] |
Non-throwing single-object delete is only called when nothrow new operator is used, and the constructor throws an exception.