fix: memory leak in extension host tree view disposal - #338235
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits intoSep 28, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Conversation
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
September 27, 2026 18:21
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The disposal path incorrectly leaves the public facade marked as a leaked disposable.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes extension-host tree view objects remaining retained after disposal.
Changes:
- Removes disposed public and internal tree views from the service store.
- Adds disposal, re-registration, shutdown, and garbage-collection tests.
| File | Description |
|---|---|
extHostTreeViews.ts |
Cleans up stored tree view registrations. |
extHostTreeViewDisposal.test.ts |
Adds lifecycle regression coverage. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 28, 2026 09:58
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 28, 2026
Martin Aeschlimann (aeschli)
approved these changes
Sep 28, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Sep 28, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-treeView-disposal
branch
September 29, 2026 11:15
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
Disposing an extension tree view removes its registration and disposes the internal view, but leaves both the public view and internal view in the extension host service lifetime store. Old providers and view state stay there until service shutdown.
Change
Remove the public view from the service store and remove and dispose the internal view when the API view is disposed. Preserve immediate re-registration and other live views.
Before
Creating a tree view, revealing an item, and disposing the view 37 times adds 37 old providers and internal views across 22 named growth rows. The service store grows from 4 to 78 registrations.
After
No more matching provider or tree-view growth is detected in the same 37-cycle test. The service store has no retired view registrations. Small unrelated object-shape differences remain.
Test Video
Seven tree-view creation, item reveal, and disposal cycles.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 24 min