![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
<agrum/tools/core/smallObjectAllocator.h> More...
#include <smallObjectAllocator.h>
Public Member Functions | |
void | displayStats () |
Displays the number of allocation and deallocation made so far. More... | |
Idx | nbAlloc () |
Idx | nbDealloc () |
Allocator / Deallocator | |
void * | allocate (const size_t &objectSize) |
Allocates a block. More... | |
void | deallocate (void *pDeallocatedObject, const size_t &objectSize) |
Deallocates an object. More... | |
Static Public Attributes | |
static const size_t | GUM_DEFAULT_CHUNK_SIZE = 8096 |
static const size_t | GUM_DEFAULT_MAX_OBJECT_SIZE = 512 |
Static Public Member Functions | |
static SmallObjectAllocator & | instance () |
Constructors / Destructors | |
SmallObjectAllocator () | |
Constructor. More... | |
SmallObjectAllocator (const SmallObjectAllocator &) | |
Copy Constructor (does nothing since we use a Singleton) More... | |
SmallObjectAllocator & | operator= (const SmallObjectAllocator &) |
Operator = (does nothing since we use a Singleton) More... | |
virtual | ~SmallObjectAllocator () |
Destructor. More... | |
<agrum/tools/core/smallObjectAllocator.h>
Allocates objects of any size
SmallObjectAllocator does so by aggregating several FixedAllocator objects. When SmallObjectAllocator receives an allocation request, it either forwards it to the best matching FixedAllocator object or passes it to the default operator new
Definition at line 55 of file smallObjectAllocator.h.
|
private |
The pool containing FixedAllocator.
Definition at line 139 of file smallObjectAllocator.h.
|
private |
Constructor.
Greater object than maxObjectSize will be forwarded to op new.
Definition at line 50 of file smallObjectAllocator_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlineprivate |
Copy Constructor (does nothing since we use a Singleton)
Definition at line 88 of file smallObjectAllocator.h.
|
virtual |
Destructor.
Definition at line 67 of file smallObjectAllocator_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void * gum::SmallObjectAllocator::allocate | ( | const size_t & | objectSize | ) |
Allocates a block.
Definition at line 86 of file smallObjectAllocator_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::SmallObjectAllocator::deallocate | ( | void * | pDeallocatedObject, |
const size_t & | objectSize | ||
) |
Deallocates an object.
pDeallocatedObject | is the object to be deallocated |
objectSize | is the size of that object (useful for faster deallocation) |
Definition at line 119 of file smallObjectAllocator_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
Displays the number of allocation and deallocation made so far.
Definition at line 127 of file smallObjectAllocator.h.
|
static |
Definition at line 73 of file smallObjectAllocator_inl.h.
References gum::Set< Key, Alloc >::emplace().
Referenced by operator=().
|
inline |
Definition at line 132 of file smallObjectAllocator.h.
|
inline |
Definition at line 133 of file smallObjectAllocator.h.
|
inlineprivate |
Operator = (does nothing since we use a Singleton)
Definition at line 93 of file smallObjectAllocator.h.
References instance().
|
private |
The memory that a chunk allocates.
Definition at line 145 of file smallObjectAllocator.h.
|
private |
The maximal size of an object befor new is called.
Definition at line 150 of file smallObjectAllocator.h.
|
private |
Definition at line 140 of file smallObjectAllocator.h.
|
static |
The | default size of chunck of memory. These chuncks are pre-allocated memory space which are then split in small memory space of the size of a small object |
Definition at line 62 of file smallObjectAllocator.h.
|
static |
The | default maximal size under which an object is considered small. If an object size is over this limit, the normal new allocator is called. |
Definition at line 69 of file smallObjectAllocator.h.
|
private |
Definition at line 152 of file smallObjectAllocator.h.
|
private |
Definition at line 153 of file smallObjectAllocator.h.