fix: memory leak in pending quick pick items by SimonSiefke · Pull Request #340846 · microsoft/vscode · GitHub
Skip to content

fix: memory leak in pending quick pick items - #340846

Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-quickPickPendingItemsDisposal
Oct 13, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-quickPickPendingItemsDisposal

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

Closing a quick pick while its item promise is pending leaves the request in MainThreadQuickOpen._items. The extension host stops supplying items after the picker closes, so the pending request and its picker stay in the map.

Change

Remove the request in the show operation's finally block. Cleanup uses that request ID and preserves other pending pickers.

Before

When closing quick picks with pending items for 37 cycles, pending request records and QuickPick widgets each rise from 0 to 37.

before

After

No more leak detected.

Test Video

test-video.webm

AI disclosure: Model: GPT-6.1-Sol. Worktime: 17 min

Copilot AI balanced review requested due to automatic review settings October 10, 2026 08:51

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

The cleanup is scoped to the correct request and is comprehensively covered by targeted tests.

0 open findings

What changed in this PR

Fixes retained pending quick-pick requests when a picker closes before its items resolve.

Changes:

  • Cleans up pending item requests in $show via finally.
  • Adds coverage for closure, cancellation, errors, accepted items, and concurrent pickers.
File Description
src/​vs/​workbench/​api/​browser/​mainThreadQuickOpen.ts Releases pending quick-pick item requests on all settlement paths.
src/​vs/​workbench/​api/​test/​browser/​mainThreadQuickOpen.test.ts Tests request cleanup and isolation across picker outcomes.

🧠 Review effort: Balanced


💡 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 76f9f30 into microsoft:main Oct 13, 2026
35 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 13, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/memory-leak-quickPickPendingItemsDisposal branch October 13, 2026 09:40
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 quick-pick Quick-pick widget issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants