title: c# (.NET): Large Generation 2 Heap with 93% free space and 100% fragmentation
body: <p>the current program I wrote have a very high memory usage like a memory leak. This is observable with help of Nagios. If the memory is very high and the program run very slow I get a memory dump via Windows task manager and analyse it with help of JetBrains dotMemory (External size is ca. 1 GB). Here I see a real usage of ca. 73 MB and a memory usage of generation 2 Heap of 660MB (!), 616 MB are marked as free and 42 MB are in use. The fragmentation is 100%. 
  I know I cannot influence managed memory and the GC should be cleanup the memory automatically. There are any things to consider to solve this problem?</p>
  
  <p>The program is a C# .NET standalone application, build with Visual Studio 2015 and .NET 4.6 in mode "Any CPU". I belive that the .NET framework on the target machine is an other version but how can I get the current installed and used version of .NET runtime?</p>
  
  <p>If you need any other information please ask me for :)</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The program is a machine control system that communicate with a SPS via OPC, contains a database access to an Orcale database and a lot of web services for communication with other bordered systems.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here is the image of memory usage from dotMemory:
  <a href="https://i.stack.imgur.com/OHwXd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OHwXd.png" alt="enter image description here"></a></p>