Skip to main content
Vu.Andy
Associate III
July 14, 2016
Question

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

  • July 14, 2016
  • 1 reply
  • 613 views
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.

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    July 15, 2016
    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 VenmoUp vote any posts that you find helpful, it shows what's working..