Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MemGuard - Memory Leak Detector in C++

Overview

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.

Features

  • Detects memory leaks
  • Tracks allocation file and line number
  • Tracks allocation size
  • Supports custom new and delete
  • Supports custom new[] and delete[]
  • Automatic leak reporting through destructor
  • Generates leak reports in memguard.log
  • Displays allocation statistics

Technologies Used

  • C++
  • STL (unordered_map)
  • Operator Overloading
  • Macros
  • File Handling

Project Structure

MemoryTracker.h MemoryTracker.cpp MemGuard.h main.cpp README.md

Build

g++ -Wall main.cpp MemoryTracker.cpp -o memguard

Run

./memguard

Sample Output

====================
MEMGUARD REPORT
====================

Total Allocations : 1
Total Frees : 0

Memory Leaks Found

Size: 400 bytes
File: main.cpp
Line: 19

Total Leaked Memory : 400 bytes

Future Improvements

  • Thread safety using mutex
  • Call stack tracking
  • GUI-based report viewer
  • Memory usage visualization
  • Shared library support

Author

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages