Controlling librcheck through signals
QNX Tool SuiteIntegrated Development Environment User's GuideDeveloperSetup
You can control librcheck by sending POSIX realtime signals to a process that has loaded this library. Using signals lets you adjust memory checking and tracing at runtime without modifying the code or relaunching the application.
Note:
For this IPC mechanism to work, the library must run a control thread.
You can request this setup by checking the Create control thread box in the
Advanced Settings for Memory Analysis
or by setting the MALLOC_CTHREAD environment variable to 2 on the command line that launches the application.
The library handles four signal types that request common data collection operations.
In the IDE, you can send signals to target processes by using the
Target Navigator.
On the command line, you can use the kill command.
The default mapping of signals to librcheck commands is:
Number | Symbol | Command | Description | Equivalent mallopt() command |
---|---|---|---|---|
41 | SIGRT#0 | control | Execute a command stored in the file defined by the MALLOC_CTRL_FILE variable. This file can contain only one command and it must be in the format given in the MALLOC_CTRL_CMD description. The control command is a convenient way to execute supported librcheck commands, even non-API commands that don't have corresponding signals. | MALLOC_CTRL_CMD |
42 | SIGRT#1 | leaks | Detect the memory leaks. This is different than enabling the dumping of memory leaks when the program exits. The leaks command makes librcheck immediately write the data describing all unreferenced blocks at the present time. If leak dumping at exit time is disabled, this command does not enable it. | None |
43 | SIGRT#2 | stop | Turn off memory tracing. You will stop seeing new allocation and deallocation events in the analysis results. | MALLOC_TRACING 0 |
44 | SIGRT#3 | start | Turn on memory tracing. You will start seeing new allocation and deallocation events in the analysis results. | MALLOC_TRACING 1 |
You can override this mapping by setting MALLOC_CTRL_SIG, which librcheck checks at startup to set up signal handling.
Page updated: