Details on the mechanics of creating tasks were covered in Chapter 7, The FreeRTOS Scheduler. Here, we will only focus on the differences in where the memory is coming from and what its lifetime is. This will help illuminate the implications of choosing different allocation schemes.
Memory for tasks can either be allocated dynamically or statically. Dynamic allocation allows the memory used by the task to be returned by calling vTaskDelete() if the task no longer needs to run (see Chapter 7, The FreeRTOS Scheduler, for details). Dynamic allocation can occur at any point in the program, whereas static allocation occurs before the program starts. The static variants of FreeRTOS API calls follow the same initialization scheme—the standard calls use dynamic allocation (pulling memory from the FreeRTOS heap). All FreeRTOS...