Dynamic vs static allocation of the tasks

Generally, the xxxxCreateStatic are given static (often file local global) memory to make the object. The advantage here is that this memory will be accepted for directly by the linker, as opposed to making sure you had enough heap reserved for it. The disadvantage is that if for some reason you decide not to create it, or later destroy it, it will still be occupying the memory. It is a ‘Static’ (un changing) allocation. A task stack so allocated can’t be adjusted at run time to be bigger.

Things created on the heap, can come and go and give up their memory for other uses.

If you don’t need the dynamic nature of a dynamic object (you will create a fixed number of them for the life of the program) than static creation is simplest in my mind, you will know after linking a very good state of your memory consumption. (You do still need to get stack sizes right),

usTaskCheckFreeStackSpace is in Task.c, it check that stack, at that point in time, and sees how much has been used, by looking at the stack pointer, and optionally by scanning the stack space to see what has been written into, to determine the stack usage. Note, it can only find overflows “after the fact”, but often it will find it quick enough to halt the system with the specific error before the system dies due to what was overwritten.