.Net Gen2 Garbage Collection Does Not Restore Gen 2 Heap Completely

Facts:

  • My application is hosted in IIS8 (Windows Server 2012)
  • .Net version 4.6.1, therefore, the GC-background is used - the background server.
  • The Gen 2 heap size, 15 minutes after the application serves the traffic, is 12gb (very reasonable since our application contains a lot of data).
  • After a six-day traffic service:
    • Counter "Gen 2 heap size" 17gb
    • The "Gen 2 collections" counter is 3600 (which means that a full gc cycle runs every 2.5 minutes, which is good for us).
    • Gen2 average collection takes about 300 ms
    • Calling GC.Collect (2, GCCollectionMode.Forced) reduces the size of the Gen 2 heap to 12gb (manually called using the API)
    • An induced GC collection takes ~ 3 seconds (probably because it is locked, not the background).

Obviously, there is no memory leak in our application, since GC induction reduces heap size.

It seems that the induced GC cycle does more work than a regular GC cycle, but could not find any information about it.

Question:

Why doesn't the regular Gen2 background compress Gen2 a bunch back to normal digits while the GC generation does?

thank

+4
source share

Source: https://habr.com/ru/post/1675794/


All Articles