Overview - Static vs dynamic allocation (configSUPPORT_STATIC_ALLOCATION)
What is it?
In FreeRTOS, memory for tasks and other objects can be allocated in two ways: statically or dynamically. Static allocation means reserving fixed memory at compile time, while dynamic allocation means reserving memory at runtime from the heap. The configSUPPORT_STATIC_ALLOCATION setting controls whether static allocation is enabled in FreeRTOS. This choice affects how memory is managed and how predictable the system behavior is.
Why it matters
Memory management is critical in embedded systems where resources are limited. Without static allocation, all memory is taken from the heap dynamically, which can cause fragmentation and unpredictable failures. Without dynamic allocation, the system loses flexibility to create tasks or objects at runtime. Enabling static allocation helps ensure reliability and control, especially in safety-critical applications.
Where it fits
Before learning this, you should understand basic FreeRTOS concepts like tasks, queues, and memory management. After this, you can explore advanced memory management techniques, heap implementations, and real-time system optimization.