Limiting a task memory usage by a task mother

Hi,
In my project, I create many tasks inside another tasks. I would like to know if it is possible to limit their memory usage by the memory of the mother task. For example, if the mother task take 15Kb of RAM memory, and there are three children tasks each one consuming 3Kb of RAM memory, then the amount 9Kb of RAM memory would come from the 15Kb of RAM memory from the mother task, remaining 6Kb of RAM memory to the mother, instead of all the four tasks use 21Kb of RAM memory.

The memory you are talking about as “task memory” sounds like it is the task STACK usage. If you create a task with a call to xTaskCreate, then this memory is taken from the Heap, which doesn’t keep track of tasks, and memory once allocated isn’t reused until returned, and you need to return all of an allocation, so that doesn’t work.

You could create the tasks with xTaskCreateStatic, at which point you pass into the function a block of memory to use for the stack, which could come as part of the stack allocated to the “parent” task. (just make sure that this memory is reserved for this purpose for the entire duration of the sub-task.

What seems simpler is just create that first task with only a 6k stack, so they add up to the value you want.