Feb 16, 2023
May 22, 2023
CMS Core
Closed, Fixed and tested
Adding an option to tweak garbage collection (GC) in relation to cache trimming.
When memory usage approaches a configured threshold, in-memory cache is trimmed, but performing a garbage collection is required to free up the memory held by evicted cache items. For this reason, the cache trimmer waits for a full generation 2 GC before trimming again; this was different from the .NET framework runtime where cache trimming ended with a forced GC. Forced GC is normally not good practice, but this fix adds CacheMemoryMonitorOptions.InducedGcInterval to reintroduce a similar behavior if the automatic GC timing (determined by the runtime) is insufficient in certain implementations.