aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index f893cae1..6ce17bf5 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -21,6 +21,7 @@ namespace slskd
{
using System;
using System.Collections.Concurrent;
+ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
@@ -139,10 +140,20 @@ namespace slskd
public void CollectGarbage()
{
+ var sw = new Stopwatch();
+
+ Log.Debug("Collecting garbage");
+
+ sw.Start();
+
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
#pragma warning disable S1215 // "GC.Collect" should not be called
GC.Collect(2, GCCollectionMode.Forced, blocking: false, compacting: true);
#pragma warning restore S1215 // "GC.Collect" should not be called
+
+ sw.Stop();
+
+ Log.Debug("Garbage collection completed in {Duration}ms", sw.ElapsedMilliseconds);
}
/// <summary>