hygoni / precise-leak-sanitizer

A dynamic memory leak detector that can pinpoint where memory is lost, using LLVM pass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PreciseLeakSanitizer

PreciseLeakSanitizer is a dynamic memory leak detector that can pinpoint where memory is lost, using LLVM pass

How to build and run

You need LLVM 17 to build this project.

Build LLVM, Clang and compiler-rt

$ mkdir build
$ cd build
$ cmake -DLLVM_ENABLE_PROJECTS="llvm;clang;compiler-rt" \
        -DCMAKE_BUILD_TYPE=Release \
        -G "Unix Makefiles" \
        ../llvm
$ make -j$(nproc)

Compile the program with -fsanitize=precise-leak

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>

Before committing code to the repository

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)

Documentation

About

A dynamic memory leak detector that can pinpoint where memory is lost, using LLVM pass

License:Apache License 2.0


Languages

Language:LLVM 39.8%Language:C++ 26.1%Language:C 23.1%Language:Assembly 9.7%Language:Objective-C 0.4%Language:Python 0.3%Language:HTML 0.2%Language:CMake 0.1%Language:Objective-C++ 0.1%Language:Cuda 0.1%Language:OCaml 0.0%Language:Shell 0.0%Language:HLSL 0.0%Language:Awk 0.0%Language:Perl 0.0%Language:JavaScript 0.0%Language:Jupyter Notebook 0.0%Language:Roff 0.0%Language:Batchfile 0.0%Language:Emacs Lisp 0.0%Language:CSS 0.0%Language:C# 0.0%Language:Vim Script 0.0%Language:Pawn 0.0%Language:Fortran 0.0%Language:Makefile 0.0%Language:Dockerfile 0.0%Language:M 0.0%Language:Cool 0.0%Language:TypeScript 0.0%Language:AppleScript 0.0%Language:RenderScript 0.0%Language:SWIG 0.0%Language:Swift 0.0%Language:Rust 0.0%Language:BitBake 0.0%