fix: memory leak in settings-tree - #327909
Open
SimonSiefke wants to merge 1 commit into
Open
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @rzhao271Matched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Settings tree memory leak by tying row toolbars to template disposal.
Changes:
- Registers each toolbar with its template’s disposable store.
- Adds a regression test verifying toolbar disposal.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
settingsTree.ts |
Disposes toolbars with row templates. |
settingsTree.test.ts |
Tests toolbar lifecycle cleanup. |
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
Opening and moving Settings from its modal editor retained every settings row toolbar through
HoverService._managedHovers. Each toolbar kept its editor group,ModalEditorPart, and the entire Settings tree alive.Change
Register each settings row
ToolBarwith the template disposable store so destroying the template disposes the toolbar and its managed hover.Before
When
settings-open.tswas run for 37 iterations withnamed-function-count3, 84,998 Settings-related allocations remained, including 79,452SettingsTreeSettingElement, 4,140SettingsTreeGroupElement, 37SettingsEditor2, and 37ModalEditorPartallocations:After
No more matching Settings tree/editor leak is detected. The same 37-run measure reports zero Settings tree,
SettingsEditor2, orModalEditorPartleak rows; ten unrelated rows remain:Test Video
settings-open.webm