Nuke binary plugins 15.1.3
 
Loading...
Searching...
No Matches
DD::Image::BlockAllocator Class Reference

#include <BlockAllocator.h>

Inheritance diagram for DD::Image::BlockAllocator:
DD::Image::IAllocator

Public Member Functions

 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.
 

Additional Inherited Members

- Static Public Member Functions inherited from DD::Image::IAllocator
template<typename T >
static T * getAllocator (IAllocator *pAllocator)
 Helper function for returning a concrete allocator type.
 

Detailed Description

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

Member Function Documentation

◆ getName()

const char * DD::Image::BlockAllocator::getName ( ) const
overridevirtual

Implements DD::Image::IAllocator.

◆ getType()

const char * DD::Image::BlockAllocator::getType ( ) const
overridevirtual

Implements DD::Image::IAllocator.

◆ getAllocatorUsage()

size_t DD::Image::BlockAllocator::getAllocatorUsage ( ) const
overridevirtual

Reimplemented from DD::Image::IAllocator.

◆ getAllocatorHighWaterMark()

size_t DD::Image::BlockAllocator::getAllocatorHighWaterMark ( ) const
overridevirtual

Reimplemented from DD::Image::IAllocator.

◆ getRequestedUsage()

size_t DD::Image::BlockAllocator::getRequestedUsage ( ) const
overridevirtual

Implements DD::Image::IAllocator.

◆ getRequestedHighWaterMark()

size_t DD::Image::BlockAllocator::getRequestedHighWaterMark ( ) const
overridevirtual

Implements DD::Image::IAllocator.

◆ resetHighWaterMark()

void DD::Image::BlockAllocator::resetHighWaterMark ( )
overridevirtual

Implements DD::Image::IAllocator.



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com