AddressSanitizer
Catch memory errors.
What Is AddressSanitizer?
AddressSanitizer (ASan) is a compiler-based tool that detects memory errors at runtime: out-of-bounds access, use-after-free, double-free, and leaks. It is fast enough for everyday testing.
Enabling ASan
Add -fsanitize=address at both compile and link time, plus -g for readable reports.
g++ -fsanitize=address -g -O1 main.cpp -o app
./appAll lessons in this course
- Using gdb and lldb
- AddressSanitizer
- UBSan and TSan
- Valgrind Basics