The RTOS kernel allocates RAM each time a task, queue, mutex, software timer or semaphore is created. The standard C library malloc() and free() functions can sometimes be used for this purpose, but …
they are not always available on embedded systems,
they take up valuable code space,
they are not thread safe, and
they are not deterministic (the amount of time taken to execute the function will differ from call to call)