[SOLVED] Is there a way to view the actually used stack and heap size in runtime?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Is there a way to view the actually used stack and heap size in runtime?

    Hi:
    I would like to shrink heap and stack size to save some RAM space.
    I can see in the memory usage page of currently allocated heap and stack:

    As you can see it's allocated with 8KB for heap and stack respectively.
    If I want to shrink the size, I need to determine how much heap and stack are actually used.
    How to view the actually used stack and heap in runtime?
    Thanks.
  • Hello,

    Thank you for your inquiry.
    There is no built in way for this in Embedded Studio.
    But you can do this manually by e.g. setting stack and heap to a certain fill value after reset with the SEGGER Linker as explained in the manual e.g. 0xCD as fill value:
    segger.com/doc/UM20005_Linker.html

    Now let your application run and with the memory window you can check the memory areas of stack and heap and analyze what the current usage is.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.