To allow the use of the dynamic memory allocation in target application, MQX Lite provides Lightweight Memory Allocation component. Allocation process is similar to using standard malloc() and free() functions available in most C run-time libraries. The difference is that MQX Lightweight Memory Allocation component provides a task safe mechanism to alloc/free memory from concurrently running tasks. MQX Lightweight Memory Allocators are also supported by the MQX Task Aware Debugging plug-in providing detailed information about allocated memory.
MQX Lite allocates memory blocks from its default memory pool, which is mapped to a standard application heap. Tasks can also create memory pools outside the default memory pool and allocate memory blocks from there.
When MQX Lite allocates a memory block, it allocates a block which is the requested size or larger (the block might be slightly larger to avoid memory fragmentation).
By default the Lightweight Memory Allocation feature is turned off.
To enable its usage in an application the user should perform these steps: