Your Site Title

C/C++ Debug

detect memory leaks

macOS

lldb leaks export MallocStackLogging=1

Sanitizer

Mac自带的clang中没有包含Sanitizer, 需要安装llvmbrew install llvm

AddressSanitizer(ASan): 内存地址越界检查(其实包括了内存泄漏检查)

Reference

Mac下C++内存检查指北(Valgrind VS Asan)
Memory check on macOS 12 Monterey?
Diagnosing Memory, Thread, and Crash Issues Early
google/sanitizers
Memory error checking in C and C++: Comparing Sanitizers and Valgrind