AddAppDataChunk and MAX_malloc()
 
 
 

Plug-ins should allocate the memory block that they pass to Animatable::AddAppDataChunk() using MAX_malloc(). This ensures that the memory buffer is allocated and de-allocated using the same heap, reducing the chances of problems related to memory corruptions.

The memory buffer passed to Animatable::AddAppDataChunk() must not be allocated on the stack or using new. This can lead to memory corruption and potentially volatile behavior of 3ds Max.