Web Log of Aleksey Nudelman: Thoughts on Software Architecture

Analysis and Review of Microsoft Technologies for IT Managers, Architects and Developers

Tuesday, January 18th

Tracking Memory Leaks in .NET


If you think you've got memory leaks, or if you're just wondering what kind of stuff is on your heap you can follow the very same steps that I do and get fabulous results your friends will envy. OK, well maybe not, but they're handy anyway.

These steps will help you to go from a suspected memory leak to the specific object references that are keeping your objects alive. See the Resources at the end for the location of all these tools.

Step 1: Run your process and put it in the state you are curious about

Be sure to choose a scenario you can reproduce if that's at all possible, otherwise you'll never know if you're making headway in clearing out the memory leaks.

Step 2: Use tasklist to find its process ID

C:\>tasklist

Image Name PID Session Name Session# Mem Usage
========================= ====== ================ ======== ============
System Idle Process 0 RDP-Tcp#9 0 16 K
System 4 RDP-Tcp#9 0 112 K
smss.exe 624 RDP-Tcp#9 0 252 K
...etc...
ShowFormComplex.exe 4496 RDP-Tcp#9 0 20,708 K
tasklist.exe 3636 RDP-Tcp#9 0 4,180 K

From here we can see that my process is ID #4496


Complete Article
aleksey on 01.18.05 @ 06:58 PM PST [link]


  Home
  Archives
Phishing Inspector is  available

Copyright© 2006 Aleksey Nudelman