|
Blender V5.3
|
MEM provides guarded memory management when using the –debug-memory option. All allocated memory is then enclosed by pads, to detect out-of-bound writes. All allocations are named to detect the source of memory leaks and print memory usage at runtime with the "Memory Statistics" operator.
MEM provides C++ template versions of the new/delete operators (#MEM_new and #MEM_delete), which are the preferred way to create and delete data in new code.
It also provides MEM_new_uninitialized and MEM_new_zeroed functions that behave like malloc and calloc respectively. These provide improved type safety, ensure that the allocated types are trivial, and reduce the casting verbosity by directly returning a pointer of the expected type. This memory should be freed with either #MEM_delete or MEM_delete_void.
There are a few reasons to use these functions:
MEM provides guarded memory management when using the –debug-memory option. All allocated memory is then enclosed by pads, to detect out-of-bound writes. All allocations are named to detect the source of memory leaks and print memory usage at runtime with the "Memory Statistics" operator.
MEM provides C++ template versions of the new/delete operators (#MEM_new and #MEM_delete), which are the preferred way to create and delete data in new code.
It also provides MEM_new_uninitialized and MEM_new_zeroed functions that behave like malloc and calloc respectively. These provide improved type safety, ensure that the allocated types are trivial, and reduce the casting verbosity by directly returning a pointer of the expected type. This memory should be freed with either #MEM_delete or MEM_delete_void.
There are a few reasons to use these functions: