Repository navigation
fix: memory leak in modalEditorPart - #326885
Merged
Benjamin Christopher Simmonds (benibenj) merged 4 commits intoSep 29, 2026
Merged
Benjamin Christopher Simmonds (benibenj) merged 4 commits into
Benjamin Christopher Simmonds (benibenj) merged 4 commits into
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Christopher Simmonds (@benibenj)Matched files:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Benjamin Christopher Simmonds (benibenj)
enabled auto-merge (squash)
July 23, 2026 13:35
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 29, 2026
Anthony Kim (anthonykim1)
approved these changes
Sep 29, 2026
Martin Aeschlimann (aeschli)
approved these changes
Sep 29, 2026
Benjamin Christopher Simmonds (benibenj)
merged commit Sep 29, 2026
21e3d6f
into
microsoft:main
35 checks passed
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-modal-editor-part
branch
September 29, 2026 11:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
When opening a modal like the new images preview, a memento seems to be created. But when closing the modal, the memento seems to be not removed.
Change
This changes it so that there is only one global memento for modals, instead of one per modal. This ensures no extra mementos are created when opening and closing a modal.
My understanding is that
modalEditorPartdoesn't need a memento at all, since it doesn't save any state:Before
When opening and closing the images modal 37 times, the number of ScopedMemento objects seems to grow by 1 each time:
After
No more leak is detected.
Test Video
video-edited-2.mp4