FreeRTOS heap implementations
Because FreeRTOS targets such a wide range of MCUs and applications, FreeRTOS offers five different types of heaps. Each heap type provides a particular set of features for dynamic allocation. When FreeRTOS is built, one of the heap types is used. The heap types are implemented in the FreeRTOS program-files heap_1.c, heap_2.c, heap_3.c, heap_4.c, and heap_5.c. These program files are distributed with the FreeRTOS source-code, and they are in the directory Source/portable/MemMang.
A note on memory pools:
Many other RTOSes include memory pools as an implementation for dynamic memory-allocation. A memory pool achieves dynamic allocation by only allocating and freeing fixed-size blocks. By constraining the block to a fixed-size, the problem of fragmentation is avoided in memory-constrained environments.
The downside to memory pools is that the blocks need to be sized for each specific application. If they are too large, they will waste...