Repository navigation
fix: memory leak in test observer disposal - #338213
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit intoSep 29, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Conversation
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
September 27, 2026 17:31
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The scoped relay correctly removes listeners without disrupting live observers, with focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes test-observer listener leaks by giving each observer an independently disposable event relay.
Changes:
- Route shared collection events through observer-scoped relays.
- Add lifecycle and event-delivery regression tests.
| File | Description |
|---|---|
src/vs/workbench/api/common/extHostTesting.ts |
Disposes observer-specific event subscriptions. |
src/vs/workbench/api/test/browser/extHostTesting.test.ts |
Tests disposal, resubscription, and collection lifecycle. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 29, 2026 02:22
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 29, 2026
Anthony Kim (anthonykim1)
approved these changes
Sep 29, 2026
Martin Aeschlimann (aeschli)
approved these changes
Sep 29, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-testObserver-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
Test observers share a test collection, but disposing one observer leaves its event listeners attached while another observer keeps the collection open. The disposed observer continues receiving test changes.
Change
Route each observer’s events through its own disposable relay and dispose that relay with the observer. Other live observers continue using the shared collection.
Before
Keeping one observer live while creating, subscribing, and disposing 37 temporary observers grows the shared collection’s listener list from 2 to 39.
After
No more leak detected.
Test Video
Seven temporary observer creation, subscription, and disposal cycles with a live peer.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 29 min