# Task Stack Size

**URL:** <https://forums.freertos.org/t/task-stack-size/5412>\
**Category:** Kernel\
**Created:** [May 15, 2008, 10:05am UTC](https://forums.freertos.org/t/task-stack-size/5412 "2008-05-15T10:05:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [May 15, 2008, 10:05am UTC](https://forums.freertos.org/t/task-stack-size/5412/1 "2008-05-15T10:05:07Z")

</div>

**[chinamaykumar](https://sourceforge.net/u/chinamaykumar/)** wrote on [Thursday, May 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/efe4c75f/#cc19):

Hi all,

i configure stack size of task=270.  
i created a task which call many functions.  
where all local variables of these function called by task&nbsp; will be stored?  
is this memoey initialisation done by rtos or at compile time?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [May 15, 2008, 12:40pm UTC](https://forums.freertos.org/t/task-stack-size/5412/2 "2008-05-15T12:40:00Z")

</div>

**[fojtik](https://sourceforge.net/u/fojtik/)** wrote on [Thursday, May 15, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/efe4c75f/#cc19/4d5e):

Looking into a source code a heap is used:

/\* Allocate space for the stack used by the task being created.  
&nbsp;&nbsp; The base of the stack memory stored in the TCB so the task can  
&nbsp;&nbsp; be deleted later if required. \*/  
pxNewTCB-\>pxStack = ( portSTACK\_TYPE \* ) pvPortMalloc( ( ( size\_t )usStackDepth ) \* sizeof( portSTACK\_TYPE ) );
