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.
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 |
45 | SIGRT#4 | marker | Insert a marker event. This is useful when trying to analyze large log files. | MALLOC_MARKER |
You can override this mapping by setting MALLOC_CTRL_SIG, which librcheck checks at startup to set up signal handling.