Skip to content

fix: memory leak in settings preview indicator - #331990

Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-settingsPreviewIndicator
Aug 21, 2026
Merged

fix: memory leak in settings preview indicator#331990
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-settingsPreviewIndicator

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

Updating a preview or experimental setting indicator registered another delayed hover without disposing the previous registration. Repeatedly switching between User and Workspace settings retained its callbacks and DOM listeners.

Change

Keep the preview indicator hover in a MutableDisposable so each update replaces the previous registration and disposal cleans up the current one.

Before

When switching between User and Workspace settings 37 times, resolveHoverOptions and its hover callbacks grow by 444 instances, while DomListener grows by 915:

before

After

No more delayed hover listener leak is detected.

Test Video

test-video.webm
Copilot AI balanced review requested due to automatic review settings August 21, 2026 15:47
@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/settingsEditorSettingIndicators.ts
  • src/vs/workbench/contrib/preferences/test/browser/settingsEditorSettingIndicators.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 indicator hover listener leak by replacing stale registrations during updates.

Changes:

  • Tracks preview/experimental hovers with MutableDisposable.
  • Adds lifecycle-focused regression coverage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
settingsEditorSettingIndicators.ts Replaces and disposes preview hover registrations.
settingsEditorSettingIndicators.test.ts Verifies replacement and final disposal.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dmitrivMS

Copy link
Copy Markdown
Collaborator
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 08d4580 into microsoft:main Aug 21, 2026
27 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 21, 2026
Abdon Morales (abdonmorales) pushed a commit to abdonmorales/vscode-utcs that referenced this pull request Aug 22, 2026
fix: dispose previous settings preview hover

Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
(cherry picked from commit 08d4580)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants