Repository navigation
fix: memory leak in terminal process startup - #340582
Open
Simon Siefke (SimonSiefke) wants to merge 4 commits into
Open
Simon Siefke (SimonSiefke) wants to merge 4 commits into
Simon Siefke (SimonSiefke) wants to merge 4 commits into
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
October 8, 2026 21:04
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The Windows-only spawn-throttling disposal path lacks deterministic test coverage.
1 open finding
What changed in this PR
Prevents PTY and title-timer creation after terminal disposal during asynchronous startup.
Changes:
- Adds a post-throttle disposal guard.
- Adds startup disposal and launch validation tests.
| File | Description |
|---|---|
terminalProcess.ts |
Stops startup after disposal. |
terminalProcess.test.ts |
Tests startup and disposal behavior. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
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
A terminal can be shut down while executable validation or spawn throttling is still pending. Startup then creates a PTY and title-polling timer after disposal, so that timer is never cleared.
Change
Check whether the terminal has been disposed after the final await and return before spawning the PTY.
Before
When disposing terminals during startup 37 times, disposed terminal instances and title-polling callbacks grow by 37:
After
No more leak detected.
Test Video
test-video.webm
AI disclosure: Model: GPT-6.1-Sol. Worktime: 26 min