i am kind of stumped on a memory leak in our application. It only happens on the customers machines, or at least tests to reproduce it on my machine have failed. Luckily our application collects some data to a log file in the event of a unhandled exception and writes a dump file if it is a OOM. It is a 32Bit C# WinForms program.
What i could find out so far:
The process was running for about three hours before it crashed
At the time of the crash the following values were collected:
currentProcess.WorkingSet64 = 1,8 GB currentProcess.VirtualMemorySize64 = 2.0 GB currentProcess.PrivateMemorySize64 = 680 MB
This is the first point that made me think it's unmanaged. Why is the WorkingSet so much higher that the PrivateMemory? I'd guess a third party dll maybe?
So for further analysis I loaded the memory dump into WinDbg
The SOS command !analyzeoom tells me: There was no managed OOM due to allocations on the GC heap. To verify I had a look at !eeheap which tells me the GC heap has a total size of 217 MB and the Loader heap 38 MB
Now i wanted to have a look at all the heaps. But using !heap -s showed a combined value of Commited Bytes 170 MB
!dumpheap -stat shows again that the biggest consumers are around 10-25 MB. There are also around 4000 Free objects which make up 38 MB.
The last value made me think that maybe the OOM is caused by fragmentation. But 38 MB does not sound that much.
At this point I am not sure how to continue How do I locate this huge amount of missing memory? How can I find out if it is a third party assembly and which one?
Sadly I can't share the memory dump because it contains sensitive customer data. But I am grateful for any advice/tips