Repository navigation
fix: memory leak in comment thread disposal - #338216
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
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The cleanup is scoped, idempotent, and adequately covered without identified regressions.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes comment-thread memory retention in live controllers.
Changes:
- Removes disposed regular and template threads from controller bookkeeping.
- Makes repeated disposal idempotent.
- Adds lifecycle and memory-retention tests.
| File | Description |
|---|---|
src/vs/workbench/api/common/extHostComments.ts |
Cleans up thread mappings during disposal. |
src/vs/workbench/api/test/common/extHostCommentThreads.test.ts |
Tests disposal, isolation, renderer interaction, and garbage collection. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 29, 2026 02:28
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 29, 2026
Anthony Kim (anthonykim1)
approved these changes
Sep 29, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Sep 29, 2026
Sandeep Somavarapu (sandy081)
approved these changes
Sep 29, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-commentThread-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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 a comment thread removes it from the editor but leaves it in its live comment controller’s thread map. The old thread, comments, and update state remain there until the controller is disposed.
Change
Remove each regular or template thread from its controller’s map when the thread is disposed. Clear the cleanup callback after disposal and make repeated disposal a no-op while preserving other live threads.
Before
Creating, displaying, and disposing a comment thread 37 times adds 37 old threads and comment payloads across 24 named growth rows. The live controller’s thread map grows from 2 to 39 entries.
After
No more matching thread or comment growth is detected in the same 37-cycle test. The controller’s thread map stays empty, and all 24 named growth rows disappear. Small unrelated object-shape differences remain.
Test Video
Seven review-thread creation, display, and disposal cycles while the comment controller stays active.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 22 min