From afdfdd88f7e200af7de1a340db052c916e31ef63 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Sun, 29 Jul 2018 11:26:55 -0700 Subject: [PATCH] Use less memory to save script details, for Microsoft/vscode#53535 --- src/chrome/chromeDebugAdapter.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/chrome/chromeDebugAdapter.ts b/src/chrome/chromeDebugAdapter.ts index ec36bb7b1..c81852379 100644 --- a/src/chrome/chromeDebugAdapter.ts +++ b/src/chrome/chromeDebugAdapter.ts @@ -801,11 +801,18 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { } else { const newValue = promiseDefer(); this._scriptIdToBreakpointsAreResolvedDefer.set(scriptId, newValue); + const dispose = () => this._scriptIdToBreakpointsAreResolvedDefer.delete(scriptId); + newValue.promise.then(dispose, dispose); + return newValue; } } protected async onScriptParsed(script: Crdp.Debugger.ScriptParsedEvent): Promise { + // The stack trace and hash can be large and the DA doesn't need it. + delete script.stackTrace; + delete script.hash; + const breakpointsAreResolvedDefer = this.getBreakpointsResolvedDefer(script.scriptId); try { this.doAfterProcessingSourceEvents(async () => { // This will block future 'removed' source events, until this processing has been completed