Behaviour - mhahnFr/LeakSanitizer GitHub Wiki

The LeakSanitizer allows you to adjust its behaviour using a set of variables.

Environment name C API name Since Type Description
LSAN_HUMAN_PRINT __lsan_humanPrint v1.0 bool Indicates whether to print human-readably formatted.
LSAN_PRINT_COUT __lsan_printCout v1.1 bool Whether to print to the default output stream.
LSAN_PRINT_FORMATTED __lsan_printFormatted v1.1 bool Printing formatted with ANSI escape codes.
LSAN_INVALID_CRASH __lsan_invalidCrash v1.0 bool Terminating after an invalid action.
LSAN_INVALID_FREE __lsan_invalidFree v1.0 bool Checking for invalid de-allocations. Best in combination with LSAN_STATS_ACTIVE. Might cause false positives.
LSAN_FREE_NULL __lsan_freeNull v1.0 bool Printing a warning if a null pointer is de-allocated.
LSAN_STATS_ACTIVE __lsan_statsActive v1.5 bool Whether to activate the statistical bookkeeping.
LSAN_PRINT_EXIT_POINT __lsan_printExitPoint v1.7 bool Printing the callstack of the exit point.
LSAN_PRINT_BINARIES __lsan_printBinaries v1.8 bool Printing the binary file names of a callstack frame.
LSAN_PRINT_FUNCTIONS __lsan_printFunctions v1.8 bool Forcing function names to be printed.
LSAN_RELATIVE_PATHS __lsan_relativePaths v1.8 bool Allowing relative paths to be printed.
LSAN_ZERO_ALLOCATION __lsan_zeroAllocation v1.8 bool Issuing a warning if zero bytes are allocated.
LSAN_LEAK_COUNT __lsan_leakCount v1.3 size_t Defines the maximum number of leaks printed.
LSAN_CALLSTACK_SIZE __lsan_callstackSize v1.3 size_t The maximum number of callstack frames to be printed.
LSAN_FIRST_PARTY_THRESHOLD __lsan_firstPartyThreshold v1.7 size_t The maximum number of first party frames to be treated as user-initiated.
LSAN_FIRST_PARTY_REGEX __lsan_firstPartyRegex v1.8 const char * Regular expression defining which binary file names are treated as first-party libraries.

All variables can be assigned a number, for boolean variables they are interpreted as in the programming language C.
Boolean variables can also be assigned (case-insensitive): true and false.

Deprecated variables

These variables will be removed entirely in version 2 of the LeakSanitizer.

Environment name C API name Since Deprecated Replaced by Description
LSAN_PRINT_STATS_ON_EXIT __lsan_printStatsOnExit v1.0 v1.7 (Removed) Whether to print the statistics upon termination.
LSAN_PRINT_LICENSE __lsan_printLicense v1.1 v1.8 (Removed) Whether to print the license notice.
LSAN_PRINT_WEBSITE __lsan_printWebsite v1.4 v1.8 (Removed) Whether to print the link to the website.
(None) __lsan_trackMemory v1.2 v1.5 __lsan_statsActive Whether to track de-allocated allocations.