Skip to main content

Command: Check Memory for Active Application

Function: The command starts the memory check for the active application.

Call: Debug menu

Requirement: The CODESYS Memory Tools package is installed. The application is in online mode.

The memory area of the active application is checked for the following:

The results of the check are displayed in the message view. Violations against the check criteria are listed as warnings.

Table 1.

Warning ID (if the check criterion is not fulfilled)

Check Criterion

MC0001

BOOL variables must be either 0 or 1 in the memory.

MC0002

Enumeration variables may only take on values which are defined in the enumeration.

MC0003

Variables of a subrange type may only take on values within the subrange.

MC0004

All strings must be terminated with zero.

MC0005

Pointers must always point to addresses which have the correct alignment.

Pointers must point to memory locations whose address is aligned to the type granularity, or is 0 or -1.

MC0006

Pointers must point to memory within the application.

Function pointers in the project must point to memory managed by CODESYS Memory Tools.

Function pointers to library POUs or external POUs are excluded because these could be in external memory.

MC0007

Pointers must refer to variables of the correct type (for example, when a POINTER TO STRING points to a REAL).

MC0008

Internal consistency of compiler structures

Function pointer addresses must be internally consistent.

MC0009

Internal consistency of compiler structures

Interface variables and function table pointers must be internally consistent.

MC0010

Internal consistency of compiler structures

MC0011

The downloaded code must not have changed since the download.

The code of compiled POUs must be unchanged.

Note: Compiled POUs with breakpoints are excluded from the check because the code is manipulated for these at runtime.

MC0012

The values of a constant must not have changed since the download.

Variable of a constant block type (STRUCT, ARRAY, etc.) must be unchanged from their initialization values.

MC0013

Internal consistency of compiler structures

MC0014

Internal consistency of compiler structures



Double-clicking a message opens the Memory view where the corresponding location is highlighted in orange.

The Memory view can also be opened by means of the View → Memory command.

The check can be limited by means of the 'memory_check' attribute.