Skip to content

coder137/memory_leak_detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Detect memory leaks in C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published