Repository navigation
fix: memory leak in terminal find widget - #346139
Merged
Dmitriy Vasyura (dmitrivMS) merged 4 commits intoNov 5, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 4 commits into
Dmitriy Vasyura (dmitrivMS) merged 4 commits into
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the terminal find widget subscription cleanup change.
No open issues 🎉
What changed in this PR
Fixes a terminal find widget memory leak by tying its focus and blur subscriptions to the terminal contribution’s disposal lifecycle.
Changes:
- Registers both subscriptions for disposal with the contribution.
- Exports the contribution class for regression tests covering subscription cleanup and disposal without creating an unused widget.
| File | Description |
|---|---|
src/vs/workbench/contrib/terminalContrib/find/test/browser/terminalFindContribution.test.ts |
Adds regression tests for subscription cleanup and lazy widget creation. |
src/vs/workbench/contrib/terminalContrib/find/browser/terminal.find.contribution.ts |
Registers focus subscriptions for disposal and exports the class for testing. |
Review effort: Balanced
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 5, 2026
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
November 5, 2026 00:11
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Vijay Upadya (vijayupadya)
approved these changes
Nov 5, 2026
Vritant Bhardwaj (vritant24)
approved these changes
Nov 5, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-terminal-find-widget
branch
November 5, 2026 11:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
The terminal find contribution subscribes to focus and blur when it creates its widget. Those subscription handles are never disposed with the contribution, so development disposable tracking reports leaked handles and records their creation stacks.
Change
Register both focus subscriptions with the terminal contribution so they are disposed before the find widget.
Before
With development disposable tracking enabled, opening and closing two terminals and opening find 37 times produces two growing terminal find creation stacks. Each contains 37 complete stack strings and 2,146 component string objects.
After
No terminal find creation-stack group grows in the matched run. Aggregate growth falls from 4,743 to 380 strings and from 140,144 to 14,748 shallow bytes. The independent terminal decoration cache growth and other string groups remain visible.
Test Video
test-video.webm
AI disclosure: Model: gpt-6.1-sol. Worktime: 3 min