|
ug4
|
#include <small_object_allocator.h>
Public Member Functions | |
| void * | allocate (std::size_t numBytes) |
| if numBytes > maxObjSize, allocate will directly call new. | |
| void | deallocate (void *p, std::size_t size) |
| make sure that size exactly specifies the number of bytes of the object to which p points. | |
Static Public Member Functions | |
| static SmallObjectAllocator & | inst () |
| returns an instance to this singleton | |
Private Member Functions | |
| SmallObjectAllocator () | |
Private Attributes | |
| std::vector< FixedAllocator > | m_allocators |
A singleton that can be used to allocate small objects.
|
private |
| void * SmallObjectAllocator< maxObjSize, maxChunkSize >::allocate | ( | std::size_t | numBytes | ) |
if numBytes > maxObjSize, allocate will directly call new.
References SmallObjectAllocator< maxObjSize, maxChunkSize >::allocate().
Referenced by SmallObjectAllocator< maxObjSize, maxChunkSize >::allocate(), and SmallObject< maxObjSize, maxChunkSize >::operator new().
| void SmallObjectAllocator< maxObjSize, maxChunkSize >::deallocate | ( | void * | p, |
| std::size_t | size | ||
| ) |
make sure that size exactly specifies the number of bytes of the object to which p points.
References p.
Referenced by SmallObject< maxObjSize, maxChunkSize >::operator delete().
|
static |
returns an instance to this singleton
Referenced by SmallObject< maxObjSize, maxChunkSize >::operator delete(), and SmallObject< maxObjSize, maxChunkSize >::operator new().
|
private |