Repository navigation
fix: memory leak in chat debug providers - #340880
Merged
Michael Lively (Yoyokrazy) merged 3 commits intoOct 12, 2026
Merged
Michael Lively (Yoyokrazy) merged 3 commits into
Michael Lively (Yoyokrazy) merged 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The lifecycle changes correctly dispose provider registrations without altering normal behavior.
0 open findings
What changed in this PR
Fixes chat debug provider leaks during extension-host teardown.
Changes:
- Tracks provider resources in a registered
DisposableMap. - Disposes registrations on unregister and clears session-resource state on teardown.
| File | Description |
|---|---|
src/vs/workbench/api/browser/mainThreadChatDebug.ts |
Ensures chat debug provider resources are disposed correctly. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Vritant Bhardwaj (vritant24)
approved these changes
Oct 12, 2026
Bhavya U (bhavyaus)
approved these changes
Oct 12, 2026
Michael Lively (Yoyokrazy)
approved these changes
Oct 12, 2026
Michael Lively (Yoyokrazy)
enabled auto-merge (squash)
October 12, 2026 19:43
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-chatDebugCustomerDisposal
branch
October 13, 2026 09:40
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
MainThreadChatDebug stores each provider's registration resources in a plain map. Its inherited disposal does not dispose those stores after an extension-host restart, leaving old providers and historical fetchers registered in ChatDebugService.
Change
Store provider registrations in a registered
DisposableMapso customer teardown disposes every owned store. UsedeleteAndDisposefor normal unregister and clear active-session resources during teardown.Before
When restarting the extension host for 37 cycles, retired provider registrations, historical fetchers, and registration stores each rise from 0 to 37. The complete chart also includes customer wrappers held by a separate task-service path.
After
The three retired resource kinds stay at 0 and all four provider callback rows disappear. There are 148 other chart rows, including the customer constructor. This change releases provider resources; it does not fix the separate customer-wrapper path.
Test Video
test-video.webm
AI disclosure: Model: GPT-6.1-Sol. Worktime: 13 min