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
 

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.



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