Main Content

Program Minimum Stack Usage

Maximum stack usage in the analyzed program taking nested scopes into account

Description

Note

Support for computing code metrics in Code Prover will be removed in a future release. See Version History.

This metric is reported in a Code Prover analysis only.

This metric shows the maximum stack usage from your program, taking nested scopes into account. The metric provides a lower bound to the stack usage since unlike the Program Maximum Stack Usage, the metric takes into account possible stack space reuse within a function and does not simply add the sizes of all local variables in a function.

The metric shows the minimum stack usage for the function with the highest stack usage. If you provide a complete application, the function with the highest stack usage is typically the main function because the main function is at the top of the call hierarchy. In multitasking or multithreaded applications, the program minimum stack usage is the minimum stack usage of the task or thread with the highest stack usage. For a description of minimum stack usage for a function, see the metric Minimum Stack Usage.

Considering nested scopes is useful for compilers that reuse stack space for variables defined in nested scopes. For instance, in this code, the space for var_1 is reused for var_2.

type func (type param_1, ...) {

  {
    /* Scope 1 */
    type var_1, ...;
  }
  {
    /* Scope 2 */
    type var_2, ...;
  }
}

Metric Information

Group: Project
Acronym: PROG_MIN_STACK
HIS Metric: No

Version History

Introduced in R2017b

expand all