diff --git a/osu.Game/Database/BackgroundDataStoreProcessor.cs b/osu.Game/Database/BackgroundDataStoreProcessor.cs index 872194aa1d..f3b37f608c 100644 --- a/osu.Game/Database/BackgroundDataStoreProcessor.cs +++ b/osu.Game/Database/BackgroundDataStoreProcessor.cs @@ -16,6 +16,7 @@ using osu.Game.Extensions; using osu.Game.Online.API; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using osu.Game.Performance; using osu.Game.Rulesets; using osu.Game.Scoring; using osu.Game.Scoring.Legacy; @@ -51,6 +52,9 @@ namespace osu.Game.Database [Resolved] private ILocalUserPlayInfo? localUserPlayInfo { get; set; } + [Resolved] + private IHighPerformanceSessionManager? highPerformanceSessionManager { get; set; } + [Resolved] private INotificationOverlay? notificationOverlay { get; set; } @@ -493,7 +497,9 @@ namespace osu.Game.Database private void sleepIfRequired() { - while (localUserPlayInfo?.IsPlaying.Value == true) + // Importantly, also sleep if high performance session is active. + // If we don't do this, memory usage can become runaway due to GC running in a more lenient mode. + while (localUserPlayInfo?.IsPlaying.Value == true || highPerformanceSessionManager?.IsSessionActive == true) { Logger.Log("Background processing sleeping due to active gameplay..."); Thread.Sleep(TimeToSleepDuringGameplay);