Updated: October 28, 2024 |
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.
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.
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.