0Pricing
C++ Academy · Lesson

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
./app

All lessons in this course

  1. Using gdb and lldb
  2. AddressSanitizer
  3. UBSan and TSan
  4. Valgrind Basics
← Back to C++ Academy