Skip to content

fix: memory leak in settings-tree - #327909

Merged
Dmitriy Vasyura (dmitrivMS) merged 4 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-settings-tree
Jul 31, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 4 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-settings-tree

Conversation

@SimonSiefke

@SimonSiefke Simon Siefke (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:

Raymond Zhao (@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.

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) enabled auto-merge (squash) July 31, 2026 00:50
@rzhao271 Raymond Zhao (rzhao271) added this to the 1.132.0 milestone Jul 31, 2026
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 4eacb47 into microsoft:main Jul 31, 2026
32 of 54 checks passed
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/memory-leak-settings-tree branch August 13, 2026 20:14
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Sep 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants