3ds Max C++ API Reference
MaxHeapOperators Class Reference

The base class in Max that controls the memory management for any class that derives from it. More...

#include <MaxHeap.h>

+ Inheritance diagram for MaxHeapOperators:

Static Public Member Functions

static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

The base class in Max that controls the memory management for any class that derives from it.

The sole purpose of this class is to provide various overloads of the new and delete operators. By doing this, any class that derives from this class and doesn't implement it's own new and delete operators will see all of its memory operation go through the Max Core. Doing this permits plugins to easily benefit from the same memory allocation optimizations the Max Core has or will receive in the future. It also permits plugins linked with a different CRT than the Max Core to safely pass memory pointers to heap blocks allocated on one side of the plugin dll boundary and deallocated on the other.

If a plugin class has to implement its own new and delete operators but also derive indirectly from MaxHeapOperators, access to the new and delete operators will have to be disambiguated. For an example on how to do this with a "using" declaration, see the class MaxWrapper in maxsdk\include\maxscrpt\maxobj.h.

Member Function Documentation

◆ operator new() [1/8]

static UtilExport void* operator new ( size_t  size)
static

Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.

Parameters
[in]sizeThe size of the object to be allocated

◆ operator new() [2/8]

static UtilExport void* operator new ( size_t  size,
const std::nothrow_t &  e 
)
static

Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.

Parameters
[in]sizeThe size of the object to be allocated
[in]eA std::nothrow_t to specify that no exception should be thrown

◆ operator new() [3/8]

static UtilExport void* operator new ( size_t  size,
const char *  filename,
int  line 
)
static

New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.

Parameters
[in]sizeThe size of the object to be allocated
[in]filenameThe name of the file that contains the call to new - may be NULL
[in]lineThe line number in the file that contains the call to new

◆ operator new() [4/8]

static UtilExport void* operator new ( size_t  size,
int  block_type,
const char *  filename,
int  line 
)
static

New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.

Parameters
[in]sizeThe size of the object to be allocated
[in]block_typeThe type of memory to be allocated by the CRT. This is always _NORMAL_BLOCK.
[in]filenameThe name of the file that contains the call to new - may be NULL
[in]lineThe line number in the file that contains the call to new

◆ operator new() [5/8]

static UtilExport void* operator new ( size_t  size,
const std::nothrow_t &  e,
const char *  filename,
int  line 
)
static

New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.

Parameters
[in]sizeThe size of the object to be allocated
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]filenameThe name of the file that contains the call to new - may be NULL
[in]lineThe line number in the file that contains the call to new

◆ operator new() [6/8]

static UtilExport void* operator new ( size_t  size,
unsigned long  flags 
)
static

New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.

Parameters
[in]sizeThe size of the object to be allocated
[in]flagsFlags specifying whether any special operations should be done when allocating memory

◆ operator new() [7/8]

static UtilExport void* operator new ( size_t  size,
const std::nothrow_t &  e,
unsigned long  flags 
)
static

New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.

Parameters
[in]sizeThe size of the object to be allocated
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]flagsFlags specifying whether any special operations should be done when allocating memory

◆ operator new[]() [1/7]

static UtilExport void* operator new[] ( size_t  size)
static

New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.

Parameters
[in]sizeThe size of the array of objects to be allocated

◆ operator new[]() [2/7]

static UtilExport void* operator new[] ( size_t  size,
const std::nothrow_t &  e 
)
static

New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.

Parameters
[in]sizeThe size of the array of objects to be allocated
[in]eA std::nothrow_t to specify that no exception should be thrown

◆ operator new[]() [3/7]

static UtilExport void* operator new[] ( size_t  size,
const char *  filename,
int  line 
)
static

New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.

Parameters
[in]sizeThe size of the array of objects to be allocated
[in]filenameThe name of the file that contains the call to new - may be NULL
[in]lineThe line number in the file that contains the call to new

◆ operator new[]() [4/7]

static UtilExport void* operator new[] ( size_t  size,
int  block_type,
const char *  filename,
int  line 
)
static

New operator used to allocate arrays of objects.

This takes the size to be allocated, the type of memory, filename and line where new was called. If there is insufficient memory, an exception will be thrown

Parameters
[in]sizeThe size of the array of objects to be allocated
[in]block_typeThe type of memory to be allocated by the CRT. This is always _NORMAL_BLOCK.
[in]filenameThe name of the file that contains the call to new - may be NULL
[in]lineThe line number in the file that contains the call to new

◆ operator new[]() [5/7]

static UtilExport void* operator new[] ( size_t  size,
const std::nothrow_t &  e,
const char *  filename,
int  line 
)
static

New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.

Parameters
[in]sizeThe size of the array of objects to be allocated
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]filenameThe name of the file that contains the call to new - may be NULL
[in]lineThe line number in the file that contains the call to new

◆ operator new[]() [6/7]

static UtilExport void* operator new[] ( size_t  size,
unsigned long  flags 
)
static

New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.

Parameters
[in]sizeThe size of the array of objects to be allocated
[in]flagsFlags specifying whether any special operations should be done when allocating memory

◆ operator new[]() [7/7]

static UtilExport void* operator new[] ( size_t  size,
const std::nothrow_t &  e,
unsigned long  flags 
)
static

New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.

Parameters
[in]sizeThe size of the array of objects to be allocated
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]flagsFlags specifying whether any special operations should be done when allocating memory

◆ operator delete() [1/8]

static UtilExport void operator delete ( void ptr)
static

Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted

◆ operator delete() [2/8]

static UtilExport void operator delete ( void ptr,
const std::nothrow_t &  e 
)
static

Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]eA std::nothrow_t to specify that no exception should be thrown

◆ operator delete() [3/8]

static UtilExport void operator delete ( void ptr,
const char *  filename,
int  line 
)
static

Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]filenameThe name of the file that contains the call to delete - may be NULL
[in]lineThe line number in the file that contains the call to delete

◆ operator delete() [4/8]

static UtilExport void operator delete ( void ptr,
int  block_type,
const char *  filename,
int  line 
)
static

Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]block_typeThe type of memory to be allocated by the CRT. This is always _NORMAL_BLOCK.
[in]filenameThe name of the file that contains the call to delete - may be NULL
[in]lineThe line number in the file that contains the call to delete

◆ operator delete() [5/8]

static UtilExport void operator delete ( void ptr,
const std::nothrow_t &  e,
const char *  filename,
int  line 
)
static

Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]filenameThe name of the file that contains the call to delete - may be NULL
[in]lineThe line number in the file that contains the call to delete

◆ operator delete() [6/8]

static UtilExport void operator delete ( void ptr,
unsigned long  flags 
)
static

Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]flagsFlags specifying whether any special operations should be done when allocating memory.

◆ operator delete() [7/8]

static UtilExport void operator delete ( void ptr,
const std::nothrow_t &  e,
unsigned long  flags 
)
static

Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]flagsFlags specifying whether any special operations should be done when allocating memory.

◆ operator delete[]() [1/7]

static UtilExport void operator delete[] ( void ptr)
static

Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the array of objects to be deleted

◆ operator delete[]() [2/7]

static UtilExport void operator delete[] ( void ptr,
const std::nothrow_t &  e 
)
static

Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.

Parameters
[in]ptrThe void pointer to the array of objects to be deleted
[in]eA std::nothrow_t to specify that no exception should be thrown

◆ operator delete[]() [3/7]

static UtilExport void operator delete[] ( void ptr,
const char *  filename,
int  line 
)
static

Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]filenameThe name of the file that contains the call to delete - may be NULL
[in]lineThe line number in the file that contains the call to delete

◆ operator delete[]() [4/7]

static UtilExport void operator delete[] ( void ptr,
int  block_type,
const char *  filename,
int  line 
)
static

Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]block_typeThe type of memory to be allocated by the CRT. This is always _NORMAL_BLOCK.
[in]filenameThe name of the file that contains the call to delete - may be NULL
[in]lineThe line number in the file that contains the call to delete

◆ operator delete[]() [5/7]

static UtilExport void operator delete[] ( void ptr,
const std::nothrow_t &  e,
const char *  filename,
int  line 
)
static

Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]filenameThe name of the file that contains the call to delete - may be NULL
[in]lineThe line number in the file that contains the call to delete

◆ operator delete[]() [6/7]

static UtilExport void operator delete[] ( void ptr,
unsigned long  flags 
)
static

Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]flagsFlags specifying whether any special operations should be done when allocating memory.

◆ operator delete[]() [7/7]

static UtilExport void operator delete[] ( void ptr,
const std::nothrow_t &  e,
unsigned long  flags 
)
static

Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.

Parameters
[in]ptrThe void pointer to the object to be deleted
[in]eA std::nothrow_t to specify that no exception should be thrown
[in]flagsFlags specifying whether any special operations should be done when allocating memory.

◆ operator new() [8/8]

static UtilExport void* operator new ( size_t  size,
void placement_ptr 
)
static

Placement new operator.

The placement new operator should only be called with a pointer that already has been allocated in the Max' heap. You can use maxheapdirect.h to allocate yourself memory on the Max' heap.

Parameters
[in]sizeThe amount of memory to allocate
[in]placement_ptrThe location where the initialization should take place

◆ operator delete() [8/8]

static UtilExport void operator delete ( void ptr,
void placement_ptr 
)
static

Placement delete operator.

Corresponds to the placement new operator. Doesn't affect memory.

Parameters
[in]ptrThe location of the memory to release.
[in]placement_ptrLocation where the destruction should take place. Should be the same as ptr.

◆ aligned_malloc()

static UtilExport void* aligned_malloc ( size_t  size,
size_t  alignment 
)
static

Allocates memory on a specified alignment boundary.

Parameters
[in]sizeThe amount of memory to allocate
[in]alignmentThe alignment value, which must be an integer power of 2.

◆ aligned_realloc()

static UtilExport void* aligned_realloc ( void ptr,
size_t  size,
size_t  alignment 
)
static

Reallocates memory on a specified alignment boundary.

Parameters
[in]ptrThe location of the memory to reallocate, allocated with aligned_malloc/aligned_realloc.
[in]sizeThe new amount of memory to allocate
[in]alignmentThe alignment value, which must be an integer power of 2.

◆ aligned_free()

static UtilExport void aligned_free ( void ptr)
static

Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.

Parameters
[in]ptrThe location of the memory to release.