# Putting a task's stack in a specific location

**URL:** <https://forums.freertos.org/t/putting-a-tasks-stack-in-a-specific-location/2924>\
**Category:** Kernel\
**Created:** [June 24, 2009, 9:23pm UTC](https://forums.freertos.org/t/putting-a-tasks-stack-in-a-specific-location/2924 "2009-06-24T21:23:23Z")\
**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:** [June 24, 2009, 9:23pm UTC](https://forums.freertos.org/t/putting-a-tasks-stack-in-a-specific-location/2924/1 "2009-06-24T21:23:23Z")

</div>

**[jdabbs003](https://sourceforge.net/u/jdabbs003/)** wrote on [Wednesday, June 24, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/84e05f57/#3674):

For performance reasons, I need to locate task stacks in a small amount of internal 32-bit wide CPU RAM.&nbsp; The general heap is a large external 16-bit memory with wait states.

Is there a way to do this?

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [June 24, 2009, 9:45pm UTC](https://forums.freertos.org/t/putting-a-tasks-stack-in-a-specific-location/2924/2 "2009-06-24T21:45:30Z")

</div>

**[richard\_damon](https://sourceforge.net/u/richard_damon/)** wrote on [Wednesday, June 24, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/84e05f57/#3674/aef7):

By selecting the appropriate heap\_x filee for your project you can control how FreeRTOS gets its memory. heap\_3 calls malloc/free getting from the general heap. heap\_1 and heap\_2 get them from a private array, which you hopefuly can force into this memory space with appropriate commands. This will move ALL FreeRTOS memory allocations into here (stacks, TCBs, and Queues). If you want to just move the stacks, you should be able to edit the create/destroy stack functions to call a different heap function then the rest of FreeRTOS, and the appropriate heap file to generate that alternate name to provide it.
