Skip to content

Commit d4ab0fd

Browse files
authored
Merge pull request #276962 from SimonSiefke/fix/memory-leak-terminal-process
fix: memory leak in terminal process (partially)
2 parents ad019be + 05fbb81 commit d4ab0fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vs/platform/terminal/node/terminalProcess.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
313313
const ptyProcess = spawn(shellLaunchConfig.executable!, args, options);
314314
this._ptyProcess = ptyProcess;
315315
this._childProcessMonitor = this._register(new ChildProcessMonitor(ptyProcess.pid, this._logService));
316-
this._childProcessMonitor.onDidChangeHasChildProcesses(value => this._onDidChangeProperty.fire({ type: ProcessPropertyType.HasChildProcesses, value }));
316+
this._register(this._childProcessMonitor.onDidChangeHasChildProcesses(value => this._onDidChangeProperty.fire({ type: ProcessPropertyType.HasChildProcesses, value })));
317317
this._processStartupComplete = new Promise<void>(c => {
318-
this.onProcessReady(() => c());
318+
this._register(this.onProcessReady(() => c()));
319319
});
320-
ptyProcess.onData(data => {
320+
this._register(ptyProcess.onData(data => {
321321
// Handle flow control
322322
this._unacknowledgedCharCount += data.length;
323323
if (!this._isPtyPaused && this._unacknowledgedCharCount > FlowControlConstants.HighWatermarkChars) {
@@ -334,11 +334,11 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
334334
}
335335
this._windowsShellHelper?.checkShell();
336336
this._childProcessMonitor?.handleOutput();
337-
});
338-
ptyProcess.onExit(e => {
337+
}));
338+
this._register(ptyProcess.onExit(e => {
339339
this._exitCode = e.exitCode;
340340
this._queueProcessExit();
341-
});
341+
}));
342342
this._sendProcessId(ptyProcess.pid);
343343
this._setupTitlePolling(ptyProcess);
344344
}

0 commit comments

Comments
 (0)