cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine the ''heap'' and ''stack'' size?

Vu.Andy
Associate III
Posted on July 14, 2016 at 23:40

I am using Keil.  How should one determine what is the best size for the heap and stack?

Are there any common guidelines?

Thanks.

1 REPLY 1
Posted on July 15, 2016 at 02:21

The common sense guidelines would be to understand how much memory you plan on malloc()ing, and how deep your call tree gets, and how large auto/local variables are.

Keil creates a static call graph in a .HTM file generated by the Linker.

Dynamically you can track malloc/free to get an idea of usage and maximal values. The stack depth can be checked, fill it with a marker character and review it periodically.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..