From 2bb0283a6855c10599e58f97eea8ca6484553a8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 12 Jul 2020 00:52:55 +0900 Subject: [PATCH] Clean up HitEvents after use to avoid near-permanent memory retention --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 9c1bc35169..eb49638d59 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -252,6 +252,12 @@ namespace osu.Game.Rulesets.Scoring HighestCombo.Value = 0; } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + hitEvents.Clear(); + } + /// /// Retrieve a score populated with data for the current play this processor is responsible for. /// @@ -269,7 +275,7 @@ namespace osu.Game.Rulesets.Scoring foreach (var result in Enum.GetValues(typeof(HitResult)).OfType().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r))) score.Statistics[result] = GetStatistic(result); - score.HitEvents = new List(hitEvents); + score.HitEvents = hitEvents; } ///