30 #ifndef GUM_SMALL_OBJECT_ALLOCATOR_H 31 #define GUM_SMALL_OBJECT_ALLOCATOR_H 34 #include <agrum/agrum.h> 36 #include <agrum/tools/core/hashTable.h> 37 #include <agrum/tools/core/smallobjectallocator/fixedAllocator.h> 112 void*
allocate(
const size_t& objectSize);
120 void deallocate(
void* pDeallocatedObject,
const size_t& objectSize);
128 GUM_TRACE(
"Nb Small Allocation : " << nbAllocation
129 <<
" - Nb Small Deallocation : " << nbDeallocation);
158 #define SOA_ALLOCATE(x) SmallObjectAllocator::instance().allocate(x) 159 #define SOA_DEALLOCATE(x, y) SmallObjectAllocator::instance().deallocate(x, y) 161 #ifndef GUM_NO_INLINE 162 # include <agrum/tools/core/smallobjectallocator/smallObjectAllocator_inl.h> SmallObjectAllocator & operator=(const SmallObjectAllocator &)
Operator = (does nothing since we use a Singleton)
static const size_t GUM_DEFAULT_MAX_OBJECT_SIZE
INLINE void emplace(Args &&... args)
static const size_t GUM_DEFAULT_CHUNK_SIZE
std::size_t _chunkSize_
The memory that a chunk allocates.
std::size_t _maxObjectSize_
The maximal size of an object befor new is called.
virtual ~SmallObjectAllocator()
Destructor.
SmallObjectAllocator(const SmallObjectAllocator &)
Copy Constructor (does nothing since we use a Singleton)
<agrum/tools/core/smallObjectAllocator.h>
void displayStats()
Displays the number of allocation and deallocation made so far.
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
HashTable< Size, FixedAllocator *> _Pool_
The pool containing FixedAllocator.
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()
SmallObjectAllocator()
Constructor.