strMemoryUsage returns information on the dynamic string memory allocated by the application.
The currently allocated number of dynamic strings and the memory used is returned by this function. Additionally the peak for both values are returned. The strMemoryUsage function can assist in locating string allocation faults.
Please also see the STRING datatype.
Input:
None.
Output:
cnt_cur : DINT
The current number of dynamic strings allocated.
cnt_peak : DINT
The maximum number of simultaneously allocated dynamic strings since device start-up.
mem_cur : DINT
The number of bytes currently used by dynamic strings.
mem_peak : DINT
The maximum number of bytes used by dynamic strings since device start-up.
Returns:
None.
Declaration:
FUNCTION strMemoryUsage;
VAR_INPUT
cnt_cur : ACCESS DINT;
cnt_peak : ACCESS DINT;
mem_cur : ACCESS DINT;
mem_peak : ACCESS DINT;
END_VAR;
Example:
INCLUDE rtcu.inc
VAR
cnt_cur : DINT;
cnt_peak : DINT;
mem_cur : DINT;
mem_peak : DINT;
END_VAR;
PROGRAM test;
BEGIN
...
strMemoryUsage(cnt_cur := cnt_cur, cnt_peak := cnt_peak, mem_cur := mem_cur, mem_peak := mem_peak);
debugFmt(message := "String count, cur = \4", v4 := cnt_cur);
debugFmt(message := "String count, peak = \4", v4 := cnt_peak);
debugFmt(message := "String memory, cur = \4", v4 := mem_cur);
debugFmt(message := "String memory, peak = \4", v4 := mem_peak);
...
END;
END_PROGRAM;
|