# Setting stack size

**URL:** https://community.particle.io/t/setting-stack-size/31840
**Category:** Firmware
**Created:** [April 19, 2017, 12:10am UTC](https://community.particle.io/t/setting-stack-size/31840 "2017-04-19T00:10:59Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)
#### Post date: [August 29, 2019, 12:47pm UTC](https://community.particle.io/t/setting-stack-size/31840/3 "2019-08-29T12:47:18Z")

</div>

@larse, there is no way to set the stack size except for new FreeRTOS threads. Calling `System.freeMemory()` show he available space on the Heap but does not indicate how fragmented it is. Often, memory issues are due to using functions that dynamically allocate and release memory on the Heap, creating fragmentation. This includes some Standard Library functions (eg. `<vector>`) and more commonly the Arduino String commands. The solution to the latter is to use c-string (char arrays) functions.

If you can describe problem more specifically, we may be able to help more.

---

_[View the full topic](https://community.particle.io/t/setting-stack-size/31840)._
