NullAllocator Class Reference

#include <nullallocator.h>

详细描述

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 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 *)

成员函数文档编制

◆  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.

参数
[in] s Block size in bytes.
[in] allocLocation Pass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
返回
Nullptr.

◆  Alloc() [2/2]

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

'Fakes' allocate memory THREADSAFE.

参数
[in] s Block size in bytes.
[in] allocLocation Pass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
返回
Nullptr.

◆  Realloc() [1/2]

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

'Fakes' resize memory THREADSAFE.

参数
[in] p Current memory block (can be nullptr)
[in] n New block size in bytes (values < 0 will return nullptr)
[in] allocLocation Pass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
返回
Nullptr.

◆  Realloc() [2/2]

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

'Fakes' resize memory THREADSAFE.

参数
[in] p Current memory block (can be nullptr)
[in] n New block size in bytes (values < 0 will return nullptr)
[in] allocLocation Pass MAXON_SOURCE_LOCATION(_NAME) to add the current source line and file.
返回
Nullptr.

◆  Free()

static MAXON_ATTRIBUTE_FORCE_INLINE void Free ( T *&  p )
static

'Fakes' free a memory block THREADSAFE.

参数
[in,out] p Memory 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 .

返回
Always true.