Change:
Testing debugging disassembly view, open developer console and notice a listener leak warning It seems like we are not properly disposing listeners when an element gets disposed in a list.
will fix this.
I think the listeners are not leaking, but there are a lot of them (actual number differs based on the size of the screen and the zoom level). So when you scroll up and down, you will see the same warning message repetitively. Although the number varies, it never grows infinitely. I.e., you got a ~175 listeners warning, it would unlikely reach a number higher than 200. The line the warning complains: It's disposed here: However, I don't really know why similar issues are not complained elsewhere, so probably I missed something. Any suggestions?
The problem is that most of those listeners should be when you create a template and dispose when you dispose a template. Since they can be shared across elements. Can you please try doing on the template level? When you do that much less listeners will be / disposed, and they will not have to be re- when you scroll.
This is still happening if you follow my original steps. Thus reopening. I suggest instead of having inside each template that you simple listen from the outside and on to refresh the whole tree
[1f3] potential listener LEAK detected, having 175 listeners already. MOST frequent listener (1): check @ at vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders… at (<anonymous) at vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders… at new we (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at S.createInstance (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at S.createInstance (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at new fe (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at S.createInstance (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at S.createInstance (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at renderTemplate (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at I.renderTemplate (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders… at (<anonymous) at H.renderTemplate (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at R.alloc (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at d.insertItemInDOM (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at d.render (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at d.onScroll (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at s.fire (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders… at s.fire (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at k._setState (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at k.setScrollDimensions (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at o.setScrollDimensions (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at d.layout (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at $.layout (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at V.layout (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at Z.layoutBody (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at Z.layout (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at a.layout (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at r.layoutViews (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at relayout (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at r.onViewChange (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders… at s.fire (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at Z.setExpanded (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at Z.setExpanded (vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…) at HTMLDivElement.<anonymous(vscode-file://vscode-app/Applications/Visual%20Studio%20Code%20-%20Insiders…)
I also got this error. Resolved by removing from my workspace a super-folder that also has a sub-folder that was included as a folder in workspace. e.g this directory structure:
happen when I open the extensions view: !

Discussion:
} interface IBreakpointColumnTemplateData { <del> container: HTMLElement, icon: HTMLElement, disposables: IDisposable[] </del> <ins> currentElement: { element?: IDisassembledInstructionEntry }; icon: HTMLElement; disposables: IDisposable[]; </ins> } class BreakpointRenderer implements ITableRenderer<IDisassembledInstructionEntry, IBreakpointColumnTemplateData> {

icon.style.alignItems = 'center'; icon.style.justifyContent = 'center'; <del> return { container, icon, disposables: [] }; } renderElement(element: IDisassembledInstructionEntry, index: number, templateData: IBreakpointColumnTemplateData, height: number | undefined): void { const rerenderDebugStackframe = () => { if (element.instruction.address === this._disassemblyView.currentInstructionAddress) { templateData.icon.classList.add(this._debugStackframe); } else { templateData.icon.classList.remove(this._debugStackframe); } templateData.icon.classList.remove(this._breakpointHintIcon); if (element.isBreakpointSet) { templateData.icon.classList.add(this._breakpointIcon); } else { templateData.icon.classList.remove(this._breakpointIcon); } }; rerenderDebugStackframe(); templateData.disposables.push(this._disassemblyView.onDidChangeStackFrame(rerenderDebugStackframe)); // TODO: see getBreakpointMessageAndIcon in vsworkbenchcontribdebugbrowserbreakpointEditorContribution.ts //       for more types of breakpoint icons if (element.allowBreakpoint) { templateData.disposables.push(addStandardDisposableListener(templateData.container, 'mouseover', () => { templateData.icon.classList.add(this._breakpointHintIcon); })); </del> <ins> const currentElement: { element?: IDisassembledInstructionEntry } = { element: undefined }; </ins> <del> templateData.disposables.push(addStandardDisposableListener(templateData.container, 'mouseout', () => { templateData.icon.classList.remove(this._breakpointHintIcon); })); </del> <ins> const disposables = [ this._disassemblyView.onDidChangeStackFrame(() => this.rerenderDebugStackframe(icon, currentElement.element)), addStandardDisposableListener(container, 'mouseover', () => { if (currentElement.element?.allowBreakpoint) { icon.classList.add(this._breakpointHintIcon); } }), addStandardDisposableListener(container, 'mouseout', () => { if (currentElement.element?.allowBreakpoint) { icon.classList.remove(this._breakpointHintIcon); } }), addStandardDisposableListener(container, 'click', () => { if (currentElement.element?.allowBreakpoint) { // click show hint while waiting for BP to resolve. icon.classList.add(this._breakpointHintIcon); if (currentElement.element.isBreakpointSet) { this._debugService.removeInstructionBreakpoints(currentElement.element.instruction.address); } else if (currentElement.element.allowBreakpoint && !currentElement.element.isBreakpointSet) { this._debugService.addInstructionBreakpoint(currentElement.element.instruction.address, 0); } } }) ]; </ins> <del> templateData.disposables.push(addStandardDisposableListener(templateData.container, 'click', () => { // click show hint while waiting for BP to resolve. templateData.icon.classList.add(this._breakpointHintIcon); if (element.isBreakpointSet) { this._debugService.removeInstructionBreakpoints(element.instruction.address); </del> <ins> return { currentElement, icon, disposables }; } </ins> <del> } else if (element.allowBreakpoint && !element.isBreakpointSet) { this._debugService.addInstructionBreakpoint(element.instruction.address, 0); } })); } </del> <ins> renderElement(element: IDisassembledInstructionEntry, index: number, templateData: IBreakpointColumnTemplateData, height: number | undefined): void { templateData.currentElement.element = element; this.rerenderDebugStackframe(templateData.icon, element); </ins> } <del> disposeElement(element: IDisassembledInstructionEntry, index: number, templateData: IBreakpointColumnTemplateData, height: number | undefined): void { </del> <ins> disposeTemplate(templateData: IBreakpointColumnTemplateData): void { </ins> dispose(templateData.disposables); templateData.disposables = []; } <del> disposeTemplate(templateData: IBreakpointColumnTemplateData): void { } </del> <ins> private rerenderDebugStackframe(icon: HTMLElement, element?: IDisassembledInstructionEntry) { if (element?.instruction.address === this._disassemblyView.currentInstructionAddress) { icon.classList.add(this._debugStackframe); } else { icon.classList.remove(this._debugStackframe); } icon.classList.remove(this._breakpointHintIcon); if (element?.isBreakpointSet) { icon.classList.add(this._breakpointIcon); } else { icon.classList.remove(this._breakpointIcon); } } </ins> } interface IInstructionColumnTemplateData { <ins> currentElement: { element?: IDisassembledInstructionEntry }; </ins> // TODO: hover widget? instruction: HTMLElement; disposables: IDisposable[];

renderTemplate(container: HTMLElement): IInstructionColumnTemplateData { const instruction = append(container, $('.instruction')); this.applyFontInfo(instruction); <del> return { instruction, disposables: [] }; </del> <ins> const currentElement: { element?: IDisassembledInstructionEntry } = { element: undefined }; const disposables = [ this._disassemblyView.onDidChangeStackFrame(() => this.rerenderBackground(instruction, currentElement.element)) ]; return { currentElement, instruction, disposables }; </ins> } renderElement(element: IDisassembledInstructionEntry, index: number, templateData: IInstructionColumnTemplateData, height: number | undefined): void { <ins> templateData.currentElement.element = element; </ins> const instruction = element.instruction; const sb = createStringBuilder(10000);

const innerText = sb.build(); templateData.instruction.innerText = innerText; <del> const rerenderBackground = () => { if (element.instruction.address === this._disassemblyView.currentInstructionAddress) { templateData.instruction.style.background = this._topStackFrameColor?.toString() || 'transparent'; } else { templateData.instruction.style.background = 'transparent'; } }; rerenderBackground(); templateData.disposables.push(this._disassemblyView.onDidChangeStackFrame(rerenderBackground)); </del> <ins> this.rerenderBackground(templateData.instruction, element); </ins> } <del> disposeElement(element: IDisassembledInstructionEntry, index: number, templateData: IInstructionColumnTemplateData, height: number | undefined): void { </del> <ins> disposeTemplate(templateData: IInstructionColumnTemplateData): void { </ins> dispose(templateData.disposables); templateData.disposables = []; } <del> disposeTemplate(templateData: IInstructionColumnTemplateData): void { } </del> <ins> private rerenderBackground(instruction: HTMLElement, element?: IDisassembledInstructionEntry) { if (element?.instruction.address === this._disassemblyView.currentInstructionAddress) { instruction.style.background = this._topStackFrameColor?.toString() || 'transparent'; } else { instruction.style.background = 'transparent'; } } </ins> private applyFontInfo(element: HTMLElement) { const fontInfo = this._disassemblyView.fontInfo;