# Internals
[Small objects]

Collaboration diagram for Internals:

## Classes

class | Loki::SmallObjAllocator
class | Loki::AllocatorSingleton< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
struct | Loki::Chunk
class | Loki::FixedAllocator

## Functions

std::size_t | Loki::GetOffset (std::size_t numBytes, std::size_t alignment)
void * | Loki::DefaultAllocator (std::size_t numBytes, bool doThrow)
void | Loki::DefaultDeallocator (void *p)

## Function Documentation

void* Loki::DefaultAllocator | ( | std::size_t | numBytes,
|  | bool | doThrow |
| ) |  |  |

Calls the default allocator when SmallObjAllocator decides not to handle a request. SmallObjAllocator calls this if the number of bytes is bigger than the size which can be handled by any FixedAllocator.

Parameters:

  | numBytes | number of bytes
  | doThrow | True if this function should throw an exception, or false if it should indicate failure by returning a NULL pointer.

Referenced by Loki::SmallObjAllocator::Allocate().

void Loki::DefaultDeallocator | ( | void * | p | ) |

Calls default deallocator when SmallObjAllocator decides not to handle a request. The default deallocator could be the global delete operator or the free function. The free function is the preferred default deallocator since it matches malloc which is the preferred default allocator. SmallObjAllocator will call this if an address was not found among any of its own blocks.

Referenced by Loki::SmallObjAllocator::Deallocate().

std::size_t Loki::GetOffset | ( | std::size_t | numBytes,
|  | std::size_t | alignment |
| ) |  |  | `[inline]`

Calculates index into array where a FixedAllocator of numBytes is located.

Referenced by Loki::SmallObjAllocator::Allocate(), Loki::SmallObjAllocator::Deallocate(), Loki::SmallObjAllocator::IsCorrupt(), Loki::SmallObjAllocator::SmallObjAllocator(), and Loki::SmallObjAllocator::TrimExcessMemory().