How can I find out how much stack and heap to allocate?

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by Joe on Thu, 11/10/2011 - 23:21 


How do I calculate the proper stack and heap size to use for a Vissim program on the 2806? Joe

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by Anders89 on Thu, 11/10/2011 - 23:27.

    Hi Joe, Stack use depends on the number of functions, interrupts, user declared and temp vars. Heap is only used when doing JTAG hotlink debugging and for some matrix manipulation. Heap allocation is done by VisSim at boot time. VisSim will issue a warning right away if there is insufficient heap allocated in the codegen dialog.

    Start off with something big that works (stack=512, heap=128) in the codegen dialog, then run your .out file in a debug diagram with the targetInterface block.

    Then, while it is running or after it is done, choose Embedded > F280x > Probe Target..., you will get a status report of the high water mark for both stack and heap. VisSim continuously monitors stack, heap, and CPU usage.