Results 1 to 2 of 2

Thread: troubleshooting a memory leak

  1. #1
    ikantspelwurdz is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Dec 2009
    Posts
    49
    Reputation
    89

    troubleshooting a memory leak

    My app has a memory leak. As a first step, I've inserted this line into the main loop:
    Code:
            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.

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    15,065
    Reputation
    2800
    You may find this post interesting: CLR Profiler

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •