Windows - Memory Leak Analysis using Windbg
Windbg is a tool from the house of MS. It come handy when debugging in a production enviornment as it is light weight. I have been using Windbg for the last few weeks and I would like to share some tips.Let us start of with memory leak analysis!
Download Location: Debugging Tools For Windows
Windbg has build in extension exts.dll which can used to find memory leaks. Here are the steps. Enable Stack backtrace from your executable using gflags.exe +ust /i
1. Start your program and start leaking your application
2. Run WinDBG and attach to the your process. (windbg.exe -pn
3. From the WinDBG command line do a !heap -stat, this will list down all the active heap blocks
4. Then do a !heap -stat -h
5. Now do a !heap -flt s
6. Then do a !heap -p -a < address >, address is the User Addr then you will get the stack trace; from where you have allocated that much bytes.
Good luck guys!!
Let your RAM Rest In Peace.
0 Comments (Post a Comment)