Can I run a .NET garbage collection from WinDbg?

后端 未结 4 2082
北海茫月
北海茫月 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:22

    I do not believe that you can trigger a GC from WinDbg.

    Here are some useful tools that I have come to rely on for memory allocation tracking:

    • SOSEX -- a further extension for WinDbg to complement SOS which adds !dumpgen to dump objects from a particular generation (great for figuring out what is on the LOH and in Gen 2) and the !refs command which will give the parent refs for an object.
    • .Net Memory Profiler -- this is a very useful tool when running interactively but it also contains an option to load from a dump file. This gives a reasonably intuitive way to track through memory usage. Easily worth the 250USD price but they also have a 14 day eval.

提交回复
热议问题