Static Memory Allocation
Static memory allocation applies to the condition that you know how much memory you need to occupy while compiling, and the static memory can’t be released or redistributed while system running. Compared with the dynamic memory allocation, static memory allocation does not need to consume CPU resources. At the same time, it would not lead to allocate unsuccessfully (because allocating unsuccessfully will directly result in the failure of the compiler). Therefore it is faster and more secure.
In CooCox CoOS, the memory that each module’s control block needs is allocated statically, such as the task control block（TCB）、event control block(ECB) 、flag control block（FCB）、flag node（FLAG_NODE）and so on.
Code 1 CooCox CoOS's space allocation of the TCB
#define CFG_MAX_USER_TASKS (8) // Determine the largest number of
// user's task in the system
#define SYS_TASK_NUM (1) // Determine the number of system tasks
// Allocate TCB space statically