From c1ea20c31218220d325826f0d2b121651309c2fe Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 13 Nov 2021 13:00:08 -0600 Subject: bump dependencies, add route to force garbage collection --- src/slskd/Core/API/Controllers/ApplicationController.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/slskd/Core/API/Controllers') diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index 16cd68b9..a7168efb 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -19,6 +19,7 @@ namespace slskd.Core.API { using System; using System.Diagnostics; + using System.Runtime; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -111,5 +112,19 @@ namespace slskd.Core.API return Ok(ApplicationStateMonitor.CurrentValue.Version); } + + /// + /// Forces garbage collection. + /// + /// + [HttpPost("gc")] + [Authorize] + public async Task CollectGarbage() + { + GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; + GC.Collect(2, GCCollectionMode.Forced, blocking: false, compacting: true); + + return Ok(); + } } } -- cgit v1.2.3