![]() |
Polygon Crucher SDK - Documentation
Documentation
|
Polygon Cruncher SDK allocates objects using xNew, xNewParams, xNewArray and delete them using xDelete, xDeleteArray. (cf XMemoryMacros.h).
You can also performs in place allocation using xConstruct.
xmalloc, xfree, xrealloc allows to perform standard C allocations.
Internally all the allocations (new or malloc) are made using the standard malloc/free allocator.
You can use XMemoryCallback memoryCallbackNotify allows to get allocation notification to override this default behavior.
This might be needed on MacOS or Linux for which new and malloc are different allocators.
For example, a crash might occur, if you allocate CXXXObject on your side using new, and if CXXXObject is deleted by the SDK (which uses the free C function).
In such case, you must use Polygon Cruncher SDK allocation method (using xNew) or override the allocator using memoryCallbackNotify.
Windows uses internally the same allocator for new and malloc and such situation (using different allocation / deletion methods) might be hidden.
The SDK can trace memory leaks in its debug version.
This is a way to verify that you allocate and release correctly the different classes.
To activate memory leak checks, use the following code:
This is important