DD::Image::HeapAllocator Class Reference

Inherits DD::Image::IAllocator.

Public Member Functions

 HeapAllocator (const char *allocatorName)
 
void * allocate (size_t size)
 
template<typename T >
T * allocate (size_t numItems)
 
template<typename T >
T * New ()
 
void deallocate (void *memory)
 
void setObjAddress (void *address)
 
template<typename T >
void Delete (T *memory)
 
virtual const char * getName () const
 
virtual const char * getType () const
 
virtual size_t getRequestedUsage () const
 
virtual size_t getRequestedHighWaterMark () const
 
virtual void resetHighWaterMark ()
 
virtual const AllocationTrackergetTracker () const
 
- Public Member Functions inherited from DD::Image::IAllocator
virtual size_t getAllocatorUsage () const
 
virtual size_t getAllocatorHighWaterMark () const
 

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

Heap Allocator

This is a very simple, thread-safe Heap allocator which calls through to DD::Image::Memory and tracks how much memory its using. Additionally, if FN_TRACK_MEMORY_ALLOCATIONS is defined (in Memory.h), and the NUKE_TRACK_OBJECT_ALLOCATIONS environment variable is set to 1, allocations using this allocator will be tracked between checkpoints, so that leaks can be identified. See the _nuke_internal.memAllocCheckpoint()/memAllocInfo() Python API calls for details.

Member Function Documentation

void DD::Image::HeapAllocator::setObjAddress ( void *  address)

Called from constructors of objects allocated using this allocator with their this pointer. This allows the allocation tracker to track the actual object address within an allocated block.



©2021 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk