|
| BlockAllocator (const char *allocatorName, const SmallBlockDefinition definition=SmallBlockDefinition()) |
|
void * | allocate (size_t size) |
|
template<typename T > |
T * | allocate (size_t numItems) |
|
template<typename T > |
T * | New () |
|
void | deallocate (void *memory) |
|
template<typename T > |
void | Delete (T *memory) |
|
const char * | getName () const override |
|
const char * | getType () const override |
|
size_t | getAllocatorUsage () const override |
|
size_t | getAllocatorHighWaterMark () const override |
|
size_t | getRequestedUsage () const override |
|
size_t | getRequestedHighWaterMark () const override |
|
void | resetHighWaterMark () override |
|
virtual const char * | getName () const =0 |
| Return the name for this allocator.
|
|
virtual const char * | getType () const =0 |
| Return the type name for this allocator (e.g. "HeapAllocator")
|
|
virtual size_t | getRequestedUsage () const =0 |
| Returns the sum total requested by the user.
|
|
virtual size_t | getAllocatorUsage () const |
|
virtual size_t | getRequestedHighWaterMark () const =0 |
| Returns the high watermark for the requested allocations.
|
|
virtual size_t | getAllocatorHighWaterMark () const |
|
virtual void | resetHighWaterMark ()=0 |
| Resets the high watermark for the allocator.
|
|
Block Allocator
This is a thread-safe allocator that, for particular sizes defined on construction, will allocate in blocks a given size and then use these instead of calling malloc
This stops lots of malloc calls, which will speed up slow system memory calls in most cases, at the expense of a memory overhead.
If a call is made to allocate outside the small block size, then it will call directly through to DD::Image::Memory::allocate()
It also tracks how much memory is currently being used by the given allocator instance