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.
-
Those who can't follow Windbg methods may use the software JustTrace for this purpose – user3164883 Jan 07 '14 at 09:39
-
Working Set? Don't worry too much about the working set. The higher the better, because it means that it is in RAM and RAM is fast. And as long as Windows decides is has enough RAM to increase the working set, that's usually ok. – Thomas Weller Sep 22 '14 at 20:14
4 Answers
What is your target Framework?
.loadby sos clr
are .net 4 commands, to debug prior Version 4 try to use
.loadby sos mscorwks

- 3,342
- 1
- 17
- 24
-
I am currently using .net 4.5. But as you said '.loadby sos mscorwks' seems to be working. Why isn't '.loadby sos clr ' working as it is .net 4.5? Please advice – user3164883 Jan 07 '14 at 09:25
-
Try the following command before loading the clr dlls: ".cordll -ve -u -l" It will give you verbose Output why it cant load a specific dll – Dominik Jan 07 '14 at 09:34
-
You have to load SOS.DLL by the command ".load _FULL_SOS_DLL_PATH_" and not by ".loadby sos clr" because usually there are different .NET frameworks installed, so you have to instruct WinDbg to load the right one...

- 8,891
- 5
- 36
- 74
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.

- 16,563
- 2
- 36
- 58
-
Telerik JustTrace is an application which is giving me the objects in the work set memory.Those who can't do it using Windbg can use that software – user3164883 Jan 07 '14 at 09:36
Another program you could use which is much easier for first time users than WinDbg is Debug Diagnostics Tool (from MSDN): http://www.microsoft.com/en-us/download/details.aspx?id=40336.
When I was working with this I would just simply create a dump file from right clicking the process in task manager.

- 4,435
- 2
- 19
- 30