How nested task allocated the stack memory?

Hello,
I have one confusion on nested tasks.
For example,
I created the main task A and allocate 200kb memory and if I create the nested task B under the Task A and allocate 100kb of memory to it.Then does this, 100kb of memory allocated from the Task A memory?

Thanks in advance for the clearification.

I don’t think you understand what tasks are or the memory you are allocating to them.

Tasks are independent entities in FreeRTOS, tasks aren’t ‘nested’ inside other tasks. If a task creates another task, that task is independent of the creating tasks. (Don’t think of threads within processes, basically in FreeRTOS you have ONE process, the whole program, and each task is sort of like a thread).

Also, when you assign memory to a task, that is JUST the ‘stack’ assigned to the task, outside that allocation, any task can allocate memory off the heap, so 200k is a LOT of memory to allocate to a task. The stack for the task will either be created with a allocation from the heap if you use xTaskCreate, or from the memory (normally static) given to xTaskCreateStatic. Once that memory is given to the task, it isn’t available for other allocations (except by the task as an automatic duration variable) until the task ends and gets deleted (if that ever happens).

Thanks @richard-damon for explanation. It is clear for me.
200k memory allocation is just for example. I m not allocation that much memory. :grin: