An application or library is organized by complex types such as programs, function blocks, global variable lists, methods, actions, functions, structures, and so on. Inside each of these types, variables can be defined.
When a complex type like a function, method, action, property Get, property Set, or a transition is called, memory on the stack is needed to execute the method. The stack size information can be used to identify the complex type which is using too much memory of the stack.
For a complex type like function or method, the sizes of the variables are summed up. When the complex type is called, the size is allocated on top of the stack and the input values are copied the allocated memory. During the code execution of the function or method, these memory values are used.
Example
Stack Size calculation example:
FUNCTION_BLOCK FB_XXX
VAR
fbComplex: FB_Test; // 20 byte
END_VAR
// method call of FB_XXX
Meth1(TRUE);
METHOD Meth1
VAR_INPUT
xTest1: BOOL;
END_VARVAR
iTest2: INT;
END_VAR
METHOD METH2
VAR_INPUT
fbComp: FB_XXX;
END_VAR
Stack Size Results
Stack Size (METH1) = 8
Stack Size (METH2) = 32