Skip to content

Conversation

@Beace
Copy link
Contributor

@Beace Beace commented Nov 26, 2025

My testing found that on my Mac, when 10 terminals were opened and left idle for a period of time, the GPU process memory increased by 167MB (319MB ->486MB). After deleting all terminals, the memory of GPU processes will not significantly decrease.

By taking a snapshot of JavaScript, it has been confirmed that the corresponding canvas has been destroyed, but the WebGL2RenderingContext has not been destroyed, resulting in the inability to release rendering memory.

image

Copilot AI review requested due to automatic review settings November 26, 2025 12:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a WebGL context memory leak in the terminal by ensuring the WebGL renderer is properly disposed when a terminal is closed. The issue was that GPU memory was not being released even after terminal canvases were destroyed, causing memory to accumulate (167MB for 10 idle terminals).

Key Changes:

  • Added explicit WebGL renderer disposal in the XtermTerminal.dispose() method

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@Beace
Copy link
Contributor Author

Beace commented Dec 3, 2025

@dbaeumer @Tyriar Could you please take a look at this issue?

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

Thanks for spotting this, I also did some other webgl addon lifecycle improvements recently in #285579 but missed this

@Tyriar Tyriar added this to the December / January 2026 milestone Jan 4, 2026
@Tyriar Tyriar enabled auto-merge January 4, 2026 15:06
@Tyriar Tyriar merged commit 9b02703 into microsoft:main Jan 4, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants