High Memory
Identify the process that consumes high Memory : use Memory Drill Down detector
We should collect multiple dumps to identify a memory leak:
Ex :1,2,3 GB
For this scenario we are going to collect at 700 and 1500 mb
Usually for memory issues we take at least 2-3 dumps to check memory evolution in time.
From the beginning we can see that the dumps size difference:
First thing we always check in the dump is the CLR version and establish if we are in a supported scenario.
Next I'll do a side by side comparison between 1st dump and 2nd dump.
Why are we checking CPU even though we are investigating high MEM usage ? GC.
A short info about !address command - address (WinDbg) - Windows drivers | Microsoft Learn
We can see the memory is filled up with big String objects.
Those objects go direct to LOH on creation Large object heap (LOH) on Windows - .NET | Microsoft Learn
They will never be collected by GC, unless specifically told to. Fundamentals of garbage collection - .NET | Microsoft Learn
Specifically in:
- 1st dump there were 200 objects measuring 204,004,400 bytes
- 2nd dump there were 1,000 objects measuring 1,020,022,000bytes (exactly 5 times the number and the size)
We can inspect 1 object in the 1st dump and share the outcome . The owner of the code should know where in the code are those huge strings created.
Analysis can go further, but that's not the purpose of this example.