About
The MAXON API provides tools to safely allocate new memory. Typically it is not needed to allocate raw memory, structures like maxon::BaseArray should be used instead (see BaseArray Manual). Memory is allocated using different allocators.
For object creation see Entity Creation.
Allocation
These macros allocate raw memory using the maxon::DefaultAllocator:
To safely handle memory one can use references, see maxon::AutoMem in References.
Alternatively one can use the finally macro to ensure the release of memory, see Finally.
Py_ssize_t i
Definition: abstract.h:645
Py_ssize_t count
Definition: abstract.h:640
#define NewMemClear(T, cnt)
Definition: defaultallocator.h:204
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:188
char Char
signed 8 bit character
Definition: apibase.h:184
#define iferr_return
Definition: resultbase.h:1519
Memory Utility
Further memory utility tools are:
finally
{
};
Py_UCS4 * res
Definition: unicodeobject.h:1113
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
void DeleteMem(T *&p)
Definition: defaultallocator.h:257
MAXON_ATTRIBUTE_FORCE_INLINE Int CompareMem(const void *block1, const void *block2, Int size)
Definition: defaultallocator.h:367
MAXON_ATTRIBUTE_FORCE_INLINE void SecureClearMem(volatile void *mem, Int size, UChar value=0)
Definition: defaultallocator.h:352
MAXON_ATTRIBUTE_FORCE_INLINE void MemCopy(void *dst, const void *src, Int size)
Definition: defaultallocator.h:284
Allocators
An allocator allocates and releases memory. Typically the maxon::DefaultAllocator is used. In rare cases when special memory alignment is needed, a custom allocator can be used.
If memory from the C standard lib is needed, use maxon::CStdLibAllocator.
FixedBufferArray testArray;
{
}
Definition: basearray.h:412
Py_ssize_t size
Definition: bytesobject.h:86
#define SIZEOF(...)
Calculates the size of a datatype or element.
Definition: apibasemath.h:214
Further Reading