Protium
Math and Design Features
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy > Class Template Reference

Singleton small object allocator. More...

#include <SmallObjectAllocator.h>

Inheritance diagram for Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >:

Public Types

typedef SmallObjectAllocator
< ThreadingModel, chunkSize,
maxSmallObjectSize,
objectAlignSize,
LifetimePolicy > 
AllocatorModel
 
typedef
Protium::Singleton::Singleton
< AllocatorModel,
Protium::Singleton::CreateStatic,
LifetimePolicy, ThreadingModel > 
AllocatorSingleton
 
typedef ThreadingModel
< AllocatorModel, MutexPolicy > 
ThreadModel
 

Public Member Functions

 SmallObjectAllocator ()
 
 ~SmallObjectAllocator (void)
 
- Public Member Functions inherited from Protium::Allocation::SmallObjectAllocatorImplementation
void * Allocate (std::size_t size, bool doThrow)
 
void Deallocate (void *p, std::size_t size)
 
void Deallocate (void *p)
 
std::size_t GetAlignment () const
 
std::size_t GetMaxObjectSize () const
 
bool IsCorrupt (void) const
 
bool TrimExcessMemory (void)
 

Static Public Member Functions

static void ClearExtraMemory (void)
 
static SmallObjectAllocator & Instance (void)
 
static bool IsCorrupted (void)
 

Private Member Functions

 SmallObjectAllocator (const SmallObjectAllocator &)
 
SmallObjectAllocator & operator= (const SmallObjectAllocator &)
 

Additional Inherited Members

- Protected Member Functions inherited from Protium::Allocation::SmallObjectAllocatorImplementation
 SmallObjectAllocatorImplementation (std::size_t pageSize, std::size_t maxObjectSize, std::size_t objectAlignSize)
 
 ~SmallObjectAllocatorImplementation (void)
 

Detailed Description

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
class Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >

Singleton small object allocator.

Definition at line 49 of file SmallObjectAllocator.h.

Member Typedef Documentation

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
typedef SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy > Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::AllocatorModel

Definition at line 52 of file SmallObjectAllocator.h.

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
typedef Protium::Singleton::Singleton< AllocatorModel, Protium::Singleton::CreateStatic, LifetimePolicy, ThreadingModel > Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::AllocatorSingleton

Definition at line 56 of file SmallObjectAllocator.h.

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
typedef ThreadingModel< AllocatorModel, MutexPolicy > Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::ThreadModel

Definition at line 53 of file SmallObjectAllocator.h.

Constructor & Destructor Documentation

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::SmallObjectAllocator ( )
inline

Definition at line 63 of file SmallObjectAllocator.h.

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::~SmallObjectAllocator ( void  )
inline

Definition at line 67 of file SmallObjectAllocator.h.

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::SmallObjectAllocator ( const SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy > &  )
private

Member Function Documentation

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
static void Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::ClearExtraMemory ( void  )
inlinestatic

Definition at line 68 of file SmallObjectAllocator.h.

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
static SmallObjectAllocator& Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::Instance ( void  )
inlinestatic

Definition at line 58 of file SmallObjectAllocator.h.

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
static bool Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::IsCorrupted ( void  )
inlinestatic

Definition at line 74 of file SmallObjectAllocator.h.

template<template< class, class > class ThreadingModel = Protium::Threads::InSingleThread, std::size_t chunkSize = 4096, std::size_t maxSmallObjectSize = 256, std::size_t objectAlignSize = 4, template< class > class LifetimePolicy = Protium::Singleton::DeleteLast, class MutexPolicy = Protium::Threads::Mutex>
SmallObjectAllocator& Protium::Allocation::SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >::operator= ( const SmallObjectAllocator< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy > &  )
private