Skip to content

xiongz-c/memory-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Memory allocation monitoring & leak detection

Memory Alllocation Monitor

Compile

g++ -o Monitor.cpp -o demo -lncurses

execute

  • Direct execution ./demo:Real-time monitoring of all processes in the system.
  • ./demo -t:Real-time monitoring of all threads running in the system.
  • ./demo -p [pid]:Real-time monitoring of all threads running under a process and the allocation and release of file descriptors in that process.

Leak Detection Tool

Compile

run.sh

# C version Launch
gcc $1.c -O0 -o "./Exec/$1"; 
gcc -D_GNU_SOURCE -shared -fPIC -o "./Lib/libMemTracker.so" MemTracker_c.c MemTracker_c.h  -ldl -rdynamic;
export LD_PRELOAD="./Lib/libMemTracker.so";
./Exec/$1 2>"./Report/$1.report";

# C++ version Launch
g++ $1.cpp -O0 -o $1 -lncurses -rdynamic;
g++ -D_GNU_SOURCE -shared -fPIC -o "./Lib/libMemTracker.so" MemTracker_cpp.cpp MemTracker_cpp.h  -ldl -rdynamic -DONLINE;
export LD_PRELOAD="./Lib/libMemTracker.so";
./$1;

execute

# C verison
cd ~/cVer
./run.sh test1

# C++ version
cd ~/cppVer
./run.sh test2
# create another  shell 
cd ~/cppVer/Exec
./Analysis test2

About

南方科技大学2021春季学期OS课程项目

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published