Controlling librcheck

You can specify the initial memory checking and tracing settings for the debug allocation library, librcheck, through Memory Analysis in the IDE or through command-line settings. You can further control memory data collection at runtime by using Memory Analysis editor controls, sending signals to the process being analyzed, and making API calls in the code.

Defining initial settings

The initial librcheck settings are defined through environment variables. Memory Analysis sets some of these variables when you launch an application with this tool enabled. One notable example is that Memory Analysis automatically turns on memory tracing at the start of a program. Some programs allocate a huge number of blocks initially, making the trace output unreadable. In these cases, you would want to disable memory tracing.

When launching applications outside of the IDE, you can set the environment variables ahead of time (e.g., in a setup script) or on the command line. An example of such a command line is given in the Using the librcheck library section of the Programmer's Guide. Details about all environment variables applicable to the debug allocation library are given in the mallopt() entry in the C Library Reference.

Adjusting memory data collection at runtime

When an application is running, there are three methods of controlling librcheck:
Memory Analysis
In the Memory Analysis editor, the Settings tab displays many of the tool's launch configuration fields as well as buttons that trigger specific operations (for active sessions only). Using this UI, you can change which memory checks get done, enable and disable tracing, and adjust the leak check interval. You'll then see the librcheck changes reflected in the latest analysis results.
The results let you interpret errors uncovered by memory checks, view the allocations and deallocations found during memory tracing, and examine details about memory leaks.
The librcheck library can handle five signal types that map to various commands. This lets you gather memory leak data, turn tracing on and off, and execute commands from in a file.
API calls
The mallopt() C library function supports many commands specific to the debug version of the allocation library. You can issue these commands in problematic areas of code, to find memory leaks or enable and disable tracing.

You can still use Memory Analysis or a command line to specify the initial librcheck behavior, but then use one or more runtime control methods to refine the memory checking and tracing. If you disabled memory tracing at the start of a program, you could turn on tracing just inside main() to see all allocations and deallocations made within the application code but not the system allocator code.

In general, any memory checking or tracing settings made at runtime override any equivalent environment variable settings that were in effect when the program was launched.