Skip to content
mhahnFr edited this page Oct 13, 2022 · 16 revisions

Here you can find all informations about the LeakSanitizer as well as the documentation of the source code.

The features

  • Sending a SIGUSR1 prints statistics of the current memory usage.
  • Sending a SIGUSR2 prints a callstack where the signal has been received.
  • More about signal handlers here.

Statistics

The statistic can be queried inside of your program, refer to the documentation of lsan_stats.h.

Example:

#include <lsan_stats.h>

int main() {
    void * pointer = malloc(150);
    
    __lsan_printStats();
    
    __lsan_printFragmentationStats();
}

Adjustments

The warnings and errors displayed by this library can also be adjusted, refer to the documentation of lsan_internals.h.

The values inside that header should be adjusted directly after startup of the program.

Example:

#include <lsan_internals.h>

int main() {
    __lsan_leakCount = 50;
}
Clone this wiki locally