PreciseLeakSanitizer is a dynamic memory leak detector that can pinpoint where memory is lost, using LLVM pass
You need LLVM 17 to build this project.
$ mkdir build
$ cd build
$ cmake -DLLVM_ENABLE_PROJECTS="llvm;clang;compiler-rt" \
-DCMAKE_BUILD_TYPE=Release \
-G "Unix Makefiles" \
../llvm
$ make -j$(nproc)
Just as other sanitizers, passing -fsanitize=precise-leak option enables PreciseLeakSanitizer. PreciseLeakSanitizer automatically enables LeakSanitizer, but it is not intended to be ran with any other sanitizers other than LeakSanitizer. Use clang or clang++ depending on which language you use.
$ ./build/bin/clang -fsanitize=precise-leak <source file>
To check if your code follows right coding style, run scripts/check-coding-style.sh. Or you can execute script/apply-coding-style.sh that automatically adjusts your code to follow the style. (clang-format command is required)