Can I run a .NET garbage collection from WinDbg?

后端 未结 4 2111
北海茫月
北海茫月 2021-01-04 01:40

I\'m looking into why a managed process is using a lot of memory. Is there a way to run GC.Collect(3) from WinDbg, so that I can focus on the actual memory allo

4条回答
  •  失恋的感觉
    2021-01-04 02:44

    Hey Roger, Hopefully your memory leak is resolved by now. :-)

    I would first be sure that it is "managed memory leak". By that I mean that when you look at Performance Monitor counters .NET CLR Memory -> # Bytes in all heaps is increasing at the same rate as the Process -> Private Bytes counter for the same process. If it is, then you can use the techniques described above.

    If it is not, you may have a native leak that is a result of running managed code. The most common that I have see is related to .NET Assemblies being loaded in the process and not unloaded. This looks like a native memory leak in Perfmon.

    I would suggest that you try running a Leak Rule in DebugDiagand see what the memory report shows as the leaking callstacks.

    Here is another great resource on the subject: I have a memory leak!!! What do i do? (defining the "where")

    Thanks, Aaron

提交回复
热议问题