basysKom Toolbox

10 – Use the AdressSanitizer

The AddressSanitizer helps you to root out memory issues


Ship software that is free from leaks and lingering memory corruption bugs.


In C and C++ it is easy to introduce issues such as memory leaks, bounds violations or use-after-frees. Both languages do not enforce memory safety, which means that programming errors can damage the internal memory management structures of a process leading to hard-to-find bugs and security issues. These issues might go undetected during development and test. The AddressSanitizer built into GCC, Clang and recently Visual Studio helps you to catch these early on by instrumenting your code with strict checks.




The best supported platform is probably X86_64/Linux with either GCC or clang but other platforms/toolchain combinations can also work.

Implementation effort

Minimal, if your software (or a sub-set like for example the unit tests) already run on X86_64/Linux.


All projects using C and C++.


  • While the AddressSanitizer is significantly faster than Valgrind it still slows down program execution.
  • The AddressSanitizer introduces a significant memory overhead.

See also

Implementation hints

  • Consider to just enable the AddressSanitizer for all debug builds.
  • Not all code in a program needs to be compiled with the AddressSanitizer, partial application is possible.
About the Toolbox

The basysKom Toolbox is a state-of-the-art collection of best practices in agile management and software development and a valuable tool for every kickoff meeting.

These cards can be used during a project kickoff in order to select best fitting good practices from the very start of your project, but also as a reminder during the course of a project implementation. Every card holds a QR code with additional information related to the specific tool, the tools’ applicability, known constraints and additional tips on how to implement it in a project setup.

You can provide us feedback on GitHub.


basysKom Newsletter

We collect only the data you enter in this form (no IP address or information that can be derived from it). The collected data is only used in order to send you our regular newsletters, from which you can unsubscribe at any point using the link at the bottom of each newsletter. We will retain this information until you ask us to delete it permanently. For more information about our privacy policy, read Privacy Policy