Skip to content

fix: memory leak in keybindings search - #346268

Merged
Ulugbek Abdullaev (ulugbekna) merged 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-keybindings-search
Nov 7, 2026
Merged

Ulugbek Abdullaev (ulugbekna) merged 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-keybindings-search

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

Every keyboard-shortcut search with no matches appends its text to latestEmptyFilters. The pooled editor keeps that array after search history is cleared and the editor closes, although the array is never read.

Change

Remove the unused query array and its append operation.

Before

Searching for 17 different missing command IDs, clearing search history and closing Keyboard Shortcuts after each search grows the unused array from 3 to 37 entries. Total string growth is 6,648 bytes/173 strings.

Before

After

Old queries no longer accumulate; their string growth falls from 1,156 bytes to zero. Only the latest query remains in search history. Total string growth is 5,392 bytes/139 strings; other growth remains.

After

Test Video

Keybindings-search.webm

AI disclosure: Model: GPT 6.1 Sol. Worktime: 22 min

Copilot AI balanced review requested due to automatic review settings November 5, 2026 15:23
@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/keybindingsEditor.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.

🟢 Approval recommended

No active review issues remain for the change removing unused storage of unmatched Keyboard Shortcuts searches.

No open issues 🎉

What changed in this PR

Fixes unnecessary memory retention in the Keyboard Shortcuts editor by removing unused storage of searches that return no matches.

Changes:

  • Removes the latestEmptyFilters array.
  • Removes the append operation that retained unmatched queries for the pooled editor’s lifetime.
File Description
src/​vs/​workbench/​contrib/​preferences/​browser/​keybindingsEditor.ts Removes unused query storage without changing search results or search history.

Review effort: Balanced

@dmitrivMS Dmitriy Vasyura (dmitrivMS) added freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues keybindings-editor Keybinding editor issues labels Nov 6, 2026
@dmitrivMS

Copy link
Copy Markdown
Collaborator

Simon Siefke (@SimonSiefke) Thank you!

@ulugbekna
Ulugbek Abdullaev (ulugbekna) merged commit 4f1cd9d into microsoft:main Nov 7, 2026
59 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 7, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/memory-leak-keybindings-search branch November 11, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues keybindings-editor Keybinding editor issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants