-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Closed
Labels
author-verification-requestedIssues potentially verifiable by issue authorIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberIssue has been confirmed by VS Code Team memberinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersterminalGeneral terminal issues that don't fall under another labelGeneral terminal issues that don't fall under another labelverifiedVerification succeededVerification succeeded
Milestone
Description
- VSCode Version: 1.51.1
- OS Version: Darwin x64 19.6.0
Steps to Reproduce:
- Open a terminal
- Type in the following: while true; do echo test; done
- Observe memory consumption: it will increase, and eventually the VS Code will die with a OOM
Does this issue occur when all extensions are disabled?: No
I investigated why it happened, and root caused it to a memory leak in xterm.js
- xterm.js has experimental buffer API here: https://github.com/xtermjs/xterm.js/blob/5cb048094e23da22ccfe46666b87d1ad427dce6d/src/browser/public/Terminal.ts#L61
- In the above line BufferNamespaceApi is created
- In the constructor of it, BufferNamepsaceApi created a listener: https://github.com/xtermjs/xterm.js/blob/5cb048094e23da22ccfe46666b87d1ad427dce6d/src/browser/public/Terminal.ts#L251 But this listener never gets removed
- .buffer is called all over the place in terminal support, thus leaking memory
It's possible to work around this issue by getting a buffer once, on xterm object creation, and using this object instead of a terminal.buffer. I checked, and it fixed the above problem. The memory consumption is stable, and vs code doesn't die.
Metadata
Metadata
Assignees
Labels
author-verification-requestedIssues potentially verifiable by issue authorIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberIssue has been confirmed by VS Code Team memberinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code InsidersterminalGeneral terminal issues that don't fall under another labelGeneral terminal issues that don't fall under another labelverifiedVerification succeededVerification succeeded