Skip to content

Memory error detector

Category: Testing and tools · Status: stub · Lessons: chapter 09, Testing and tools

One line: A tool that instruments allocations and stack frames so that reading or writing storage whose lifetime has ended is reported at run time — AddressSanitizer, Valgrind's Memcheck.

Also called: AddressSanitizer, ASan, Valgrind, Memcheck.

How it connects

In each language

Rust Miri ↗ interprets MIR and reports undefined behaviour in unsafe code, including dangling references
C -fsanitize=address ↗ in Clang and GCC alike; ASAN_OPTIONS=detect_stack_use_after_return=1 adds the frames a function has already returned from
C++ The same flag, plus -fsanitize=undefined ↗ for the checks that are not about memory

Where to read more