Server is leaking memory; but process looks fine

2019-09-01 01:57发布

问题:

I wrote a WCF (c#) Windows Service application, and it appears to me the windows service is leaking memory. The memory pressure, according to Windows, raised from the start of the windows service from 24 Gb till 44 Gb at the moment of the screen shot (30 hours later)

We have two problems;

  1. we tried to simulate the leakage using ANTS Memory Profiler, and we couldn't find the issue.
  2. WCF service itself is not leaking memory. The memory usage is 18 Gb (which is the same memory pressure as from the start of the service).

How can I investigate this problem? What is causing this high memory pressure?

回答1:

it appears to us, this is expected behaviour. We never saw this behaviour as the Development machines have less memory available. Only when 92 % - 95 % of the memory is 'occupied' a garbage collection is forced.

The reason we looked at this problem was because the processes were running more slow after a while.

Interesting reads: .NET application memory usage - high unused .NET and unmanaged memory and fragmentation

http://forum.memprofiler.com/viewtopic.php?f=2&t=4389

And put this book on my book shelf: http://download.red-gate.com/ebooks/DotNet/Under_the_Hood_of_.NET_Management.pdf

Thanks all,