Skip to content

fix: memory leak in settings-tree - #327909

Open
SimonSiefke wants to merge 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-settings-tree
Open

fix: memory leak in settings-tree#327909
SimonSiefke wants to merge 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-settings-tree

Conversation

@SimonSiefke

@SimonSiefke SimonSiefke commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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 ToolBar with the template disposable store so destroying the template disposes the toolbar and its managed hover.

Before

When settings-open.ts was run for 37 iterations with named-function-count3, 84,998 Settings-related allocations remained, including 79,452 SettingsTreeSettingElement, 4,140 SettingsTreeGroupElement, 37 SettingsEditor2, and 37 ModalEditorPart allocations:

settings-open before

After

No more matching Settings tree/editor leak is detected. The same 37-run measure reports zero Settings tree, SettingsEditor2, or ModalEditorPart leak rows; ten unrelated rows remain:

settings-open after

Test Video

settings-open.webm

Copilot AI review requested due to automatic review settings July 28, 2026 21:37
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@rzhao271

Matched files:

  • src/vs/workbench/contrib/preferences/browser/settingsTree.ts
  • src/vs/workbench/contrib/preferences/test/browser/settingsTree.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants