MemGuard is a lightweight memory leak detection tool developed in C++.
It tracks dynamic memory allocations and deallocations by overloading custom memory operators. At program termination, it reports memory leaks along with allocation details such as file name, line number, allocation size, and memory statistics.
- Detects memory leaks
- Tracks allocation file and line number
- Tracks allocation size
- Supports custom
newanddelete - Supports custom
new[]anddelete[] - Automatic leak reporting through destructor
- Generates leak reports in
memguard.log - Displays allocation statistics
- C++
- STL (
unordered_map) - Operator Overloading
- Macros
- File Handling
MemoryTracker.h MemoryTracker.cpp MemGuard.h main.cpp README.md
g++ -Wall main.cpp MemoryTracker.cpp -o memguard./memguard====================
MEMGUARD REPORT
====================
Total Allocations : 1
Total Frees : 0
Memory Leaks Found
Size: 400 bytes
File: main.cpp
Line: 19
Total Leaked Memory : 400 bytes
- Thread safety using mutex
- Call stack tracking
- GUI-based report viewer
- Memory usage visualization
- Shared library support
Indira Krupadarshini Midde
Electronics and Communication Engineering Graduate
Developed MemGuard as a C++ systems programming project to understand memory management, operator overloading, STL containers, and memory leak detection.