LeakSanitizer (LSan) is a heap leak detector similar to HeapLeakChecker or to the leak checker in Valgrind/Memcheck. LSan can be run on top of AddressSanitizer with no additional slowdown compared to plain ASan.
See https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer for more information.
LeakSanitizer is enabled on the ASan bots on chromium.memory (both Linux and ChromeOS, with the exception of the "sandboxed" bot). All ASan trybots also have LSan enabled.
You should fix the CL instead. The leaks may be harmless, but letting them accumulate over time has a negative impact on the stability of our bots. If you leak memory intentionally, use an in-code annotation instead (see
Ideally, you should only land suppressions for leaks in third-party code that you have no control over. If that is the case, take a look at build/sanitizers/lsan_suppressions.cc. The syntax is as follows:
The wildcard will be matched against the function/module/source file name of each frame in the stack trace. Supported special characters are
Please be careful not to make the wildcard too generic. The TSan v2 page has some examples of good and bad suppressions.
You can supply additional suppressions by adding
LeakSanitizer is supported on x86_64 Linux only. To build, follow the ASan build instructions and add
Note: Leak detection must not be enabled at this time, or LSan will find leaks during the build process and fail. Make sure
At run-time, add
ASAN_OPTIONS="detect_leaks=1 symbolize=1 external_symbolizer_path=$SRC/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer" out/Release/base_unittests
A typical LSan report looks like this:
Note that LeakSanitizer is incompatible with the sandbox. You must pass
(NOTE: the libstdc++ part is no longer required for Chromium, where we now use a custom libc++ binary for ASan builds.)
Be aware that ASan's fast stack unwinder depends on frame pointers, which are often missing in release versions of shared libraries. If you want to use the fast unwinder (enabled by default), you should at least install a debug version of libstdc++. This worked for us on Ubuntu:
If you still see incomplete stack traces, you can disable the fast unwinder by adding
GLib may not play well with leak detection tools in the default mode. We recommend to pass
LSan can also be used without ASan instrumentation. In
In this mode leak detection is enabled by default. When building, you must explicitly set