The check command enables checking of memory access, leaks, or usage and prints the current status of runtime checking (RTC). It is valid only in native mode.
The features of runtime checking that are enabled by this command are reset to their initial state by the debug command.
This section provides information about the options for the check command.
check [functions] [files] [loadobjects]
Equivalent to check –all; suppress all; unsuppress all in functions, files, and loadobjects
functions is one or more function names.
files is one or more file names.
loadobjects is one or more load object names.
You can use this to focus runtime checking on places of interest.
The –access option enables checking. RTC reports the following errors:
Out of memory
Read from array out-of-bounds memory
Read from unallocated memory
Read from uninitialized memory
Write to array out-of-bounds memory
Write to read-only memory
Write to unallocated memory
The default behavior is to stop the process after detecting each access error, which can be changed using the rtc_auto_continue dbxenv variable. When set to on, access errors are logged to a file. The log file name is controlled by the dbxenv variable rtc_error_log_file_name.
By default, each unique access error is only reported the first time it happens. You can change this behavior using the dbxenv variable rtc_auto_suppress. The default setting of this variable is on.
The syntax for the –leaks option is:
check –leaks [–frames n] [–match m]
Enable leak checking. RTC reports the following errors:
Possible memory leak – The only pointer points in the middle of the block
Possible memory leak – Pointer to the block exists only in register
Memory leak – No pointers to the block
With leak checking enabled, an automatic leak report is generated when the program exits. All leaks including possible leaks are reported at that time. By default, a non-verbose report is generated, which can be changed through the dbxenv variable rtc_mel_at_exit. However, you can ask for a leak report at any time (see showleaks Command).
–frames n implies that up to n distinct stack frames are displayed when reporting leaks. –match m is used for combining leaks; if the call stack at the time of allocation for two or more leaks matches n frames, then these leaks are reported in a single combined leak report.
The default value of n is 8 or the value of m (whichever is larger). Maximum value of n is 16. The default value of m is 8.
The syntax for the –memuse option is:
check –memuse [–frames n] [–match m]
The –memuse option behaves similarly to the –leaks option and also enables a blocks-in-use report (biu) when the program exits. By default, a non-verbose blocks in use report is generated, which can be changed through the dbxenv variable rtc_biu_at_exit. At any time during program execution you can see where the memory in your program has been allocated (see showmemuse Command).
–frames n implies that up to n distinct stack frames will be displayed while reporting memory use and leaks. Use –match m to combine these reports. If the call stack at the time of allocation for two or more leaks matches m frames, then these leaks are reported in a single combined memory leak report.
The default value of n is 8 or the value of m, whichever is larger. The maximum value of n is 16. The default value of m is 8.
The syntax for the –all option is:
check –all [–frames n] [–match m]
check –access and check –memuse [–frames n] [–match m]
The value of the dbxenv variable rtc_biu_at_exit is not changed with check –all, so by default no memory use report is generated at exit. See dbx Command for the description of the rtc_biu_at_exit environment variable.