Memory in an MCU consists of Registers, RAM and ROM (flash). Variable data is stored in RAM. Heap and stack are allocated from RAM. Memory space is wasted only if we are permanently occupying space that can be used somewhere else. We use dynamic allocation only if we intend to release the space after the function has been executed, why heap memory is used for for FreeRTOS Task's?