# How many threads I can create.

**URL:** <https://forums.freertos.org/t/how-many-threads-i-can-create/2245>\
**Category:** Kernel\
**Created:** [April 29, 2009, 2:52pm UTC](https://forums.freertos.org/t/how-many-threads-i-can-create/2245 "2009-04-29T14:52:03Z")\
**Posts on this page:** 4\
**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:** [April 29, 2009, 2:52pm UTC](https://forums.freertos.org/t/how-many-threads-i-can-create/2245/1 "2009-04-29T14:52:03Z")

</div>

**[psilva2007](https://sourceforge.net/u/psilva2007/)** wrote on [Wednesday, April 29, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/63ffbac9/#6f7f):

Hi.

My application has aproximately 8 thread and it is running ok, but if I put the 9th thread it hangs.

Has freertos a variable to configure the total threads that I can create?

Best regards.

Paulo

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [April 29, 2009, 2:55pm UTC](https://forums.freertos.org/t/how-many-threads-i-can-create/2245/2 "2009-04-29T14:55:35Z")

</div>

**anonymous** wrote on [Wednesday, April 29, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/63ffbac9/#6f7f/4b27):

Do you have enough RAM to hold all the threads stacks? Have you checked xTaskCreate return value?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [April 29, 2009, 2:59pm UTC](https://forums.freertos.org/t/how-many-threads-i-can-create/2245/3 "2009-04-29T14:59:53Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Wednesday, April 29, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/63ffbac9/#6f7f/4e8b):

\> Has freertos a variable to configure the total threads that I  
\> can create?

No you can continue to create tasks until you run out of heap RAM. Which memory file are you using? Heap\_1 and heap\_2 are sized using configTOTAL\_HEAP\_SIZE in FreeRTOSConfig.h.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [April 29, 2009, 6:26pm UTC](https://forums.freertos.org/t/how-many-threads-i-can-create/2245/4 "2009-04-29T18:26:57Z")

</div>

**[psilva2007](https://sourceforge.net/u/psilva2007/)** wrote on [Wednesday, April 29, 2009](https://sourceforge.net/p/freertos/discussion/382005/thread/63ffbac9/#6f7f/4ea4):

I am using heap\_2, and all of you are right, I decreased the amount of stack to the new thread and it was created without a problem. So my problem is not enough memory.

Thak you all.

Paulo
