Higher Estimate of Size of Local Variables
Total size of all local variables in function
Description
This metric provides a conservative estimate of the total size of local variables in a function. The metric is the sum of the following sizes in bytes:
Size of function return value
Sizes of function parameters
Sizes of local variables
Additional padding introduced for memory alignment
Your actual stack usage due to local variables can be different from the metric value.
Some of the variables are stored in registers instead of on the stack.
Your compiler performs variable liveness analysis to enable certain memory optimizations. For instance, compilers store the address to which the execution returns following the function call. When computing this metric, Polyspace® does not consider these optimizations.
Your compiler uses additional memory during a function call. When computing this metric, Polyspace does not consider this hidden memory usage.
Compilers optimize temporary variables in different ways. This metric excludes temporary variables. Only the variables that are explicitly declared by the user are considered.
However, the metric provides a reasonable estimate of the stack usage due to local variables.
To determine the sizes of basic types, the software uses your specifications for Target processor type (-target)
. The metric also takes
into account #pragma pack
directives in your code.
Examples
Metric Information
Group: Function |
Acronym:
LOCAL_VARS_MAX |
HIS Metric: No |
Version History
Introduced in R2016b