Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Dump code of a process

My C# application is consuming too much working set memory and I want to see the objects that are there in the work set memory.I dumped the process and created a dump file as the answer of this question. How do I use a dump file to diagnose a memory leak? But I am unable to debug the file from Windbg as it says 'unable to load clr' when I type the command, '.loadby sos clr'. Also the commands '!dumpheap -stat' and '!threads' also say that 'No export threads found'. Please advice me a way to debug this dumped file and find the objects.Please provide a solution apart from using VS2013 Ultimate.

like image 208
user3164883 Avatar asked Oct 29 '25 01:10

user3164883


2 Answers

I recommend you to use Psscor2 or Psscor4 extensions (depending .NET version used by you application). After setting up the debugging environment (installing WinDbg and copying to its folder Psscor files) load dump file and load appropriate version of Psscor:

.load psscor4

Then execute command to download symbols from Microsoft servers (if needed), make sure that you have an internet connection:

!symfix

And from now you should have access to plenty very interesting commands (look for !help to list them). To see memory usage per type use:

!dumpheap -stat

To see overall memory usage (iu means that also unrooted objects will be included):

!heapstat -iu

You can also use VMMap tool to see overall memory usage of the process (not memory dump) to see how much of it is consumed by the managed heap.

like image 113
Konrad Kokosa Avatar answered Oct 30 '25 17:10

Konrad Kokosa


What is your target Framework?

.loadby sos clr 

are .net 4 commands, to debug prior Version 4 try to use

.loadby sos mscorwks
like image 37
Dominik Avatar answered Oct 30 '25 17:10

Dominik