NullAllocator Class Reference

#include <nullallocator.h>

Detailed Description

The Null allocator is an allocator that returns no memory, no matter what memory size was requested. It can be used, e.g. in combination with the class FixedBufferAllocator. THREADSAFE.

Static Public Member Functions

static Int ComputeArraySize (Int currentSize, Int increment, Int MINCHUNKSIZE)
 
static MAXON_ATTRIBUTE_FORCE_INLINE void * Alloc (Int32 s, MAXON_SOURCE_LOCATION_DECLARATION)
 
static MAXON_ATTRIBUTE_FORCE_INLINE void * Alloc (Int64 s, MAXON_SOURCE_LOCATION_DECLARATION)
 
static MAXON_ATTRIBUTE_FORCE_INLINE void * Realloc (void *p, Int32 n, MAXON_SOURCE_LOCATION_DECLARATION)
 
static MAXON_ATTRIBUTE_FORCE_INLINE void * Realloc (void *p, Int64 n, MAXON_SOURCE_LOCATION_DECLARATION)
 
template<typename T >
static MAXON_ATTRIBUTE_FORCE_INLINE void Free (T *&p)
 
static MAXON_ATTRIBUTE_FORCE_INLINE Bool IsCompatibleWithDefaultAllocator (void *)
 

Member Function Documentation

◆ ComputeArraySize()

static Int ComputeArraySize ( Int  currentSize,
Int  increment,
Int  MINCHUNKSIZE 
)
static

Computes the new size for a growing array, same as in DefaultAllocator THREADSAFE.

◆ Alloc() [1/2]

static MAXON_ATTRIBUTE_FORCE_INLINE void* Alloc ( Int32  s,
MAXON_SOURCE_LOCATION_DECLARATION   
)
static

'Fakes' allocate memory THREADSAFE.

Parameters
[in]sBlock size in bytes.
[in]allocLocationPass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
Returns
Nullptr.

◆ Alloc() [2/2]

static MAXON_ATTRIBUTE_FORCE_INLINE void* Alloc ( Int64  s,
MAXON_SOURCE_LOCATION_DECLARATION   
)
static

'Fakes' allocate memory THREADSAFE.

Parameters
[in]sBlock size in bytes.
[in]allocLocationPass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
Returns
Nullptr.

◆ Realloc() [1/2]

static MAXON_ATTRIBUTE_FORCE_INLINE void* Realloc ( void *  p,
Int32  n,
MAXON_SOURCE_LOCATION_DECLARATION   
)
static

'Fakes' resize memory THREADSAFE.

Parameters
[in]pCurrent memory block (can be nullptr)
[in]nNew block size in bytes (values < 0 will return nullptr)
[in]allocLocationPass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
Returns
Nullptr.

◆ Realloc() [2/2]

static MAXON_ATTRIBUTE_FORCE_INLINE void* Realloc ( void *  p,
Int64  n,
MAXON_SOURCE_LOCATION_DECLARATION   
)
static

'Fakes' resize memory THREADSAFE.

Parameters
[in]pCurrent memory block (can be nullptr)
[in]nNew block size in bytes (values < 0 will return nullptr)
[in]allocLocationPass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
Returns
Nullptr.

◆ Free()

static MAXON_ATTRIBUTE_FORCE_INLINE void Free ( T *&  p)
static

'Fakes' free a memory block THREADSAFE.

Parameters
[in,out]pMemory block address (can be nullptr, will be nullptr after return)

◆ IsCompatibleWithDefaultAllocator()

static MAXON_ATTRIBUTE_FORCE_INLINE Bool IsCompatibleWithDefaultAllocator ( void *  )
static

Returns if a memory block allocated via this allocator can be reallocated or freed by the DefaultAllocator.

Returns
Always true.