-
Notifications
You must be signed in to change notification settings - Fork 2
Behaviour
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 | Boolean | Indicates whether to print human-readably formatted. |
LSAN_PRINT_COUT |
__lsan_printCout |
v1.1 | Boolean | Whether to print to the default output stream. |
LSAN_PRINT_FORMATTED |
__lsan_printFormatted |
v1.1 | Boolean | Printing formatted with ANSI escape codes. |
LSAN_INVALID_CRASH |
__lsan_invalidCrash |
v1.0 | Boolean | Terminating after an invalid action. |
LSAN_INVALID_FREE |
__lsan_invalidFree |
v1.0 | Boolean | Checking for invalid de-allocations. Best in combination with LSAN_STATS_ACTIVE . Might cause false positives.
|
LSAN_FREE_NULL |
__lsan_freeNull |
v1.0 | Boolean | Printing a warning if a null pointer is de-allocated. |
LSAN_STATS_ACTIVE |
__lsan_statsActive |
v1.5 | Boolean | Whether to activate the statistical bookkeeping. |
LSAN_PRINT_EXIT_POINT |
__lsan_printExitPoint |
v1.7 | Boolean | Printing the callstack of the exit point. |
LSAN_PRINT_BINARIES |
__lsan_printBinaries |
v1.8 | Boolean | Printing the binary file names of a callstack frame. |
LSAN_PRINT_FUNCTIONS |
__lsan_printFunctions |
v1.8 | Boolean | Forcing function names to be printed. |
LSAN_RELATIVE_PATHS |
__lsan_relativePaths |
v1.8 | Boolean | Allowing relative paths to be printed. |
LSAN_ZERO_ALLOCATION |
__lsan_zeroAllocation |
v1.8 | Boolean | Issuing a warning if zero bytes are allocated. |
LSAN_LEAK_COUNT |
__lsan_leakCount |
v1.3 | Non-negative number | Defines the maximum number of leaks printed. |
LSAN_CALLSTACK_SIZE |
__lsan_callstackSize |
v1.3 | Non-negative number | The maximum number of callstack frames to be printed. |
LSAN_FIRST_PARTY_THRESHOLD |
__lsan_firstPartyThreshold |
v1.7 | Non-negative number | The maximum number of first party frames to be treated as user-initiated. |
LSAN_FIRST_PARTY_REGEX |
__lsan_firstPartyRegex |
v1.8 | String | Regular expression defining which binary file names are treated as first-party libraries. |
LSAN_AUTO_STATS |
None | v1.11 | Number and optional unit | When a time interval is set in this variable, the statistics are printed automatically with this interval in between. |
Boolean variables can be assigned a number, they are interpreted as in the programming language C.
They can also be assigned (case-insensitive): true
and false
.
The following units are available for the LSAN_AUTO_STATS
:
-
ns
: nanoseconds -
us
: microseconds -
ms
: milliseconds -
s
: seconds -
m
: minutes -
h
: hours
The default unit when none is given is seconds.
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. |
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".