Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.19 KB

README.md

File metadata and controls

65 lines (45 loc) · 1.19 KB

memory_leak_detector

Detect memory leaks in C by wrapping raw malloc and free APIs

  • Keeps track of allocated memory using generic linked list

Building

cmake -B build -G Ninja

Testing

  • Tested with GCC (10.2) and MSVC (16.8.2) compiler on Windows
  • Tested with GCC (9.3) compiler compiler on Linux

No memory leak test

# Enter the build folder
cd build

# Build the project
cmake --build .

# Run the test
ctest -V --output-on-failure

No memory leak

Memory leak test

  • Modify test/test_mldmalloc.c
  • Allocate memory using mld_malloc and do not mld_free
  • Run the above commands for default testing
# Enter the build folder
cd build

# Build the project
cmake --build .

# Run the test
ctest --output-on-failure

Memory leak

Checklist

  • Location (pointer) of memory leak
  • Data size of memory leak
  • Unit-Testing
  • Code coverage
  • CI/CD