troubleshooting a memory leak

ikantspelwurdz

Well-known member
Joined
Dec 8, 2009
Messages
49
Programming Experience
1-3
My app has a memory leak. As a first step, I've inserted this line into the main loop:
VB.NET:
        Dim c As Process = Process.GetCurrentProcess()
            Dim s As String = "Mem: " & c.WorkingSet64 / 1024 & " K " & _
            "VM: " & c.PagedMemorySize64 / 1024 & " K " & _
            "GC: " & GC.GetTotalMemory(True) / 1024 & " K"
        DebugTrace(s)

Five hours later, this is the result:
memleak.png

So obviously this is an unmanaged memory leak, which doesn't surprise me. The app does a lot of COM interop, so I'd wager some COM object is being created and re-created and not being disposed of reliably.

Can the type of memory be drilled down further? The Process class has a whole bunch of memory related properties. Are any of them worth logging too? Maybe even all of them, cumbersome as that may be?

Or are there any other tools available I can use that might help figure out where the memory is going (and staying)? I am using VS2010, BTW.
 
Back
Top