fix: memory leak in extension host pseudoterminals - #333397
Merged
Megan Rogge (meganrogge) merged 1 commit intoAug 31, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
August 30, 2026 14:17
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes extension-host pseudoterminal resource leaks during terminal closure and process exit.
Changes:
- Tracks pseudoterminal listeners and buffered-data subscriptions for disposal.
- Cleans process resources from both closure paths.
- Adds regression coverage for terminal-close cleanup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
extHostTerminalService.ts |
Adds pseudoterminal lifecycle cleanup. |
extHostTerminalService.test.ts |
Tests cleanup after terminal closure. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Simon Siefke (SimonSiefke)
force-pushed
the
fix/memory-leak-extension-host-pseudoterminal-disposal
branch
from
August 30, 2026 14:25
8fa001c to
481d87f
Compare
Megan Rogge (meganrogge)
approved these changes
Aug 31, 2026
Megan Rogge (meganrogge)
left a comment
Collaborator
There was a problem hiding this comment.
Thank you!
Connor Peet (connor4312)
approved these changes
Aug 31, 2026
roblourens
approved these changes
Aug 31, 2026
Anthony Kim (anthonykim1)
approved these changes
Aug 31, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-extension-host-pseudoterminal-disposal
branch
September 1, 2026 14:33
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
Closing an extension-owned terminal removes the terminal API object, but process cleanup only runs from the pseudoterminal's
onDidCloseevent. A pseudoterminal does not have to provide that event, so its process entry, buffered-data subscription, and event listeners remain after the terminal closes.Change
Run process cleanup from both the terminal-close path and the process-exit path. Include the pseudoterminal, its event subscriptions, and the data-buffer subscription in the process disposable, and skip listener setup if the terminal closed before setup completed.
Before
When creating and disposing an extension pseudoterminal 37 times, the pseudoterminal, terminal API object, and callbacks grow each time:
After
No more extension host pseudoterminal leak is detected.
Test Video
go-progress-terminal.webm