From edbba6e635ea3837724cb89245ccbfc3833b726f Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:57:19 -0600 Subject: [PATCH] [Bug][Performance] Plug memory leak related to enemy pokemon lingering around (#6083) Remove animationupdate in sprite cleanupAndComplete --- src/data/battle-anims.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/data/battle-anims.ts b/src/data/battle-anims.ts index bed17fb0ebc..24212fd2fb5 100644 --- a/src/data/battle-anims.ts +++ b/src/data/battle-anims.ts @@ -880,6 +880,10 @@ export abstract class BattleAnim { targetSprite.pipelineData["tone"] = [0.0, 0.0, 0.0, 0.0]; targetSprite.setAngle(0); + // Remove animation event listeners to enable sprites to be freed. + userSprite.off("animationupdate"); + targetSprite.off("animationupdate"); + /** * This and `targetSpriteToShow` are used to restore context lost * from the `isOppAnim` swap. Using these references instead of `this.user`