-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Here you can find all information about the LeakSanitizer as well as the documentation of the source code.
- 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.
The statistic can be queried inside 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(); }
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; }
The LeakSanitizer can also help to find invalid free
s.
To do so, enable the
__lsan_invalidFree
and disable the
__lsan_invalidCrash
:
#include <lsan_internals.h> int main() { __lsan_invalidFree = true; __lsan_invalidCrash = false; }
Copyright (C) 2022 - 2024 mhahnFr.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".