How to dump only the first object address with !DumpHeap (.load sos)
-
18-09-2019 - |
Question
I habe a few million objects hanging around in memory. I want to find the gcroots for them so I need an object address. !DumpHeap however dumps all objects which is taking longer than i had the patience to wait. How can i limit its output to only one object address? I am using Visual Studio 2008 btw.
Solution
Jason Evans is right. My version does not have the -l switch, so here is the workaround I use: I use the end parameter to restrict the output to an address range like this:
!dumpheap -mt 0794f29c 0 04000000
The last address is the highest address I allow. By increasing the address in small steps, I eventually hit the first few objects.
OTHER TIPS
!dumpheap -type System.String -short
Will only dump the address of the objects
The best place to start is the -stat argument. This will dump a summary of the live object table as opposed to every object in the system. It will give you a good idea on what objects in particular are causing the most overhead
!dumpheap -stat
I would also recomend taking a look at the following blog articles as they are geared to helping people use WinDbg to track down this sort of problem