https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
If you haven't got the ASAN libraries installed on the run host, or you are going to use another LD_PRELOAD'd lib like onload, you'll have to build 'static-libasan':
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS='-fsanitize=address -fno-omit-frame-pointer' -DCMAKE_MODULE_LINKER_FLAGS='-fsanitize=address -static-libasan' -DCMAKE_EXE_LINKER_FLAGS='-fsanitize=address -static-libasan'
- Virtual memory must not be limited by
ulimit -v
or byLimitAS
in a systemd unit file - Output from the address sanitizer will be printed to stderr, and available in the journal
- Preventing LeaK Detector exiting a process with non-zero code for tests, export LSAN_OPTIONS=exitcode=0