fix: memory leak in titleBarPart - #327552
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit intoJul 27, 2026
Merged
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Christopher Simmonds (@benibenj)Matched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes menu bar controls and listeners being retained after visibility toggles.
Changes:
- Clears title bar menu visibility listeners alongside the control.
- Makes the activity bar’s
MutableDisposablethe control’s sole owner.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
titlebarPart.ts |
Disposes menu visibility listeners when uninstalling the menu bar. |
activitybarPart.ts |
Removes duplicate lifetime ownership of the menu control. |
Benjamin Christopher Simmonds (benibenj)
approved these changes
Jul 27, 2026
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
July 27, 2026 11:04
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jul 27, 2026
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Ulugbek Abdullaev (ulugbekna)
approved these changes
Jul 27, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Each time the menu bar was hidden and shown, VS Code created a new
CustomMenubarControl. The previous control's visibility listener was kept for the lifetime of the title bar, which also kept that control and its menu actions in memory.Change
When removing a menu bar, clear its visibility listener and
CustomMenubarControltogether. The activity bar now uses its existingMutableDisposableas the sole owner, so replacing a control releases the previous instance.Before
Before the change, toggling the menu bar 37 times left menu bar controls and their actions in memory, with counts growing after every toggle:
After
After the change, repeating the same 37 toggles reports no matching menu bar leak.
Test Video
test-video.webm