title: .Net Gen2 garbage collection doesn't reclaim Gen 2 heap completely
body: <p><strong>Facts:</strong></p>
  
  <ol>
  <li>My app is hosted in IIS8 (Windows Server 2012)</li>
  <li>.Net version is 4.6.1, hence GC flavor used is <em>Background server</em></li>
  <li>Gen 2 heap size, 15 minutes after app is serving traffic, is <strong>12gb</strong> (very reasonable since our app holds a lot of data).</li>
  <li>After six days serving traffic:
  
  <ul>
  <li>"Gen 2 heap size" counter is <strong>17gb</strong></li>
  <li>"# Gen 2 collections" counter is 3600 (which means there is full gc cycle once every 2.5 minutes, which is good for us)</li>
  <li>Average Gen2 collection takes about <strong>300ms</strong></li>
  <li>Calling <em>GC.Collect(2, GCCollectionMode.Forced)</em> reduces Gen 2 heap size to <strong>12gb</strong> (invoked manually using a API)</li>
  <li>Induced GC collection takes <strong>~3seconds</strong> (probably because it is <em>blocked</em> and not <em>background</em>).</li>
  </ul></li>
  </ol>
  
  <p>Obviously, there is no memory leak in our application since inducing GC shrinks the heap size.</p>
  
  <p>It seems that induced GC cycle is doing <strong>more work</strong> than regular GC cycle but couldn't find any information about this.</p>
  
  <p><strong>The question is:</strong></p>
  
  <p>Why doesn't a regular background Gen2 collection shrink Gen2 heap back to normal figures, while inducing GC does?</p>
  
  <p>Thanks</p>