Skip to main content
Search

Tab: Stack Usage

Tab in the task configuration editor

The Stack Usage tab shows the current stack usage for each application, for each task, and for the POUs in the maximum call stack.

Requirement for the information to be displayed: The application code has been generated. This is done either automatically when logging in to the controller or explicitly using the BuildGenerate Code command.

Override default stack size from the target settings

Important

Overriding the stack size in Available stack size is an expert function.

This input field is available only when you activate the option here and confirm the message that appears then. The message indicates that there may be a risk of a stack overflow. Exception errors may occur.

_cds_icon_option_deactivated.png: The Available stack size input field shows the currently set default stack size from the device description. Input is not permitted. Default setting.

_cds_icon_option_activated.pngThe Available stack size input field can be edited. You can specify a new value there or reset it to the default value.

_cds_icon_taskconfiguration_stackusage_reset.png Reset to default

Clicking on the button resets the value in Available stack size to the default stack size. The default stack size is defined in the device description.

Available stack size

Available stack size (in bytes)

Example: 4,194,304

The maximum stack size is specified in the device description. This default stack size is read and applied as the available stack size.

You can change the value if the Override default stack size from the target settings option is activated.

The compiler checks the maximum stack usage in the application during compile and reports an error based on this calculated size if an overflow is possible.

Assumed stack size for external calls

Stack size (in bytes) which is assumed for external calls to the runtime system

Example: If it says 24, then it is assumed that a call to an external function uses 24 bytes on the stack

Note: The result of the calculation of the stack usage is always an estimate.

A general estimated value for the stack size of an external call is specified in the device description. This value is used for the calculation. This is true unless a special estimated value has been assigned to an external call with the attribute 'estimated-stack-usage'. In this case, the special value is preferred.

Task/Maximum Call Stack

Call stack determined during compile (call hierarchy)

Hint: If the call stack is empty in this view, then you can start a compile operation and call the CreateGenerate Code command. The current information on stack usage is then available.

Stack Size

Used stack size (in bytes) per called POU

Or stack size added up via the call hierarchy for a task

During compile time, the compiler calculates the maximum stack usage for the maximum call chain.

Important: When a POU is displayed in red, this means that a stack overflow has been detected for this POU. The following POUs are also displayed in red due to memory overflow.

For more information, see: Calculation of the Stack Usage