Skip to content

fix: memory leak in terminalProcessManager - #326930

Merged
Megan Rogge (meganrogge) merged 2 commits into
microsoft:mainfrom
SimonSiefke:fix/terminal-process-manager-memory-leak
Jul 22, 2026
Merged

Megan Rogge (meganrogge) merged 2 commits into
microsoft:mainfrom
SimonSiefke:fix/terminal-process-manager-memory-leak

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

Uses a MutableDisposable so resolving a terminal environment replaces the previous listener.

Before

When running the same task 37 times, terminal environment listeners grow each time (outlined in red):

task-run-fix-terminal-process-manager-memory-leak-before

After

No more leak is detected for this listener.

task-run-fix-terminal-process-manager-memory-leak-after

Copilot AI review requested due to automatic review settings July 22, 2026 09:16
@vs-code-engineering

vs-code-engineering Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Anthony Kim (@anthonykim1)

Matched files:

  • src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts
  • src/vs/workbench/contrib/terminal/test/browser/terminalProcessManager.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes repeated terminal environment listener retention during process relaunches.

Changes:

  • Tracks the listener with MutableDisposable.
  • Replaces or clears the previous listener during environment resolution.

Comment thread src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts

@meganrogge Megan Rogge (meganrogge) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@meganrogge
Megan Rogge (meganrogge) enabled auto-merge (squash) July 22, 2026 18:02
@meganrogge
Megan Rogge (meganrogge) merged commit 82a00be into microsoft:main Jul 22, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.131.0 milestone Jul 22, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/terminal-process-manager-memory-leak branch July 28, 2026 16:51
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Sep 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants