Address Sanitizer in C++ (A Tutorial)

Опубликовано: 20 Май 2026
на канале: arisaif
9,539
133

In this video, I will show you how to use address sanitizer to debug your C++ code and detect memory leaks, memory corruption bugs, and undefined behavior in your programs. I will also describe how Address Sanitizer works and how to use it in G++ and Bazel.

Link to the repo used in this video: https://github.com/ourarash/cpp-template.
A video describing how to use this repo:    • C++ starter repo for Bazel & Visual Studio...  
Installing Bazel: https://bazel.build/install
Installing Graphviz: https://graphviz.org/download/
-----------------------------------------------------
Chapters:

Introduction 00:00
Examples of memory misuse 00:55
What is Address Sanitizer? 1:47
What kind of bugs does address sanitizer detect? 2:44
How does address sanitizer work? 3:15
How can you enable address sanitizer? 5:19
Enabling address sanitizer in G++: 5:45
Enabling address sanitizer in Bazel: 6:13
Examples of bugs that can be detected by address sanitizer: 6:41
When should you use address sanitizer? 16:58
Limitations of address sanitizer: 17:19

-----------------------------------------------------
Let me know if you have any questions in the comments!
-----------------------------------------------------
See my other videos on:
How to use Google Benchmark for C++ Programs:    • How to use Google Benchmark for C++ programs  
Bazel and unit tests with GTest:    • Bazel & Google Test in Visual Studio Code  
Debugging in Visual Studio Code for C++:    • Debugging C++ in Visual Studio Code using ...  
Visual Studio Code, Top Features:    • Visual Studio Code Top Features 2020  
-----------------------------------------------------
Keep in touch with me:
  / ourarash  
  / ourarash  

I'm the founder of BitcoinCrazyness app, the Most Advanced Cryptocurrency mobile APP for alerts, Check it out:

http://www.bitcoincrazyness.com/