Ensuring there's always enough RAM available

I have a system where I need to allocate a very large static array, as large as RAM allows.
For that reason I don’t do any dynamic memory allocation.
But my understanding is that freeRTOS does, with its default settings, allocate memory dynamically.
Is there a way to ensure that 100% of freeRTOS memory/resources is allocated statically so I will always know exactly the amount and make my array as large as possible?

If not, what how do I find the absolutely maximum amount of memory it uses in worst case scenario?

Thank you

Set configSUPPORT_DYNAMIC_ALLOCATION in your FreeRTOSConfig.h to 0.


1 Like

As aggarg says, if you set configSUPPORT_DYNAMIC_ALLOCATION to 0 there won’t be ANY dynamic allocation in the FreeRTOS kernal, you will have to also set configSUPPORT_STATIC_ALLOCATION to 1 (I don’t think it defaults to on if dynamic is 0, unless that is something new).
Then you can look at your link map and see what is left.

1 Like

Thank you Richard and Gaurav :slight_smile: