From 4e1597eeb3fb36bbd41752e85377dab9ed89122c Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 26 Jul 2020 14:27:24 +1000 Subject: [PATCH] Fix AI mem leak? (#1482) Holy shit I'm dumb for missing that AGAIN. Co-authored-by: Metal Gear Sloth --- .../AI/Pathfinding/Accessible/AiReachableSystem.cs | 7 +++++++ Content.Server/GameTicking/GameTicker.cs | 2 ++ 2 files changed, 9 insertions(+) diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs index 9905bc9c3b..b7f0322969 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs @@ -125,6 +125,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible _cachedAccessible.Clear(); } + public void ResettingCleanup() + { + _queuedUpdates.Clear(); + _regions.Clear(); + _cachedAccessible.Clear(); + } + private void RecalculateNodeRegions(PathfindingChunkUpdateMessage message) { // TODO: Only need to do changed nodes ideally diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 35d6509e9f..156fc374af 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -13,6 +13,7 @@ using Content.Server.GameObjects.Components.Observer; using Content.Server.GameObjects.Components.PDA; using Content.Server.Interfaces.GameObjects.Components.Interaction; using Content.Server.GameObjects.EntitySystems.AI.Pathfinding; +using Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible; using Content.Server.GameTicking.GamePresets; using Content.Server.Interfaces; using Content.Server.Interfaces.Chat; @@ -622,6 +623,7 @@ namespace Content.Server.GameTicking // Reset pathing system EntitySystem.Get().ResettingCleanup(); + EntitySystem.Get().ResettingCleanup(); _spawnedPositions.Clear(); _manifest.Clear();