Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.86.0 OS Version: Ubuntu 23.04 Steps to Reproduce: an empty notebook file the the opening and closing the file several times that the number of disposable stores increases each time Looking at the stacktrace, it shows a lot of are created in : It seems that the is not registered like other disposables, possibly causing a memory leak. Also in , the disposable doesn't seem to be registered: <!-- prettier-ignore --It seems a possible solution could be to register both disposables using . <details<summaryClick to expand</summaryThis output above captures the disposable stores as an array of arrays. Each inner array represents a disposable store with the stacktraces. For example, this represents a disposable store with one disposable, which has been created by in : This represents a disposable store with three disposables: This represents two disposable stores: One empty disposable store and one disposable store with three disposables: The full output contains 194 entries . It seems like a lot. Looking at the stacktrace, it shows the are created in : It seems that the is not registered like other disposables, it could be the cause of the memory leak. The full output also contains 110 entries . Looking at the stacktrace, it shows the are created in function in It seems there could be a possible actions memory leak in But here I couldn't find what exactly the problem is. </details
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.86.1. Please try upgrading to the latest version and checking whether this issue remains. Happy Coding!

Discussion:
this._notebookOptions = creationOptions.options ?? new NotebookOptions(this.creationOptions?.codeWindow ?? mainWindow, this.configurationService, notebookExecutionStateService, codeEditorService, this._readOnly); this._register(this._notebookOptions); <ins> const eventDispatcher = this._register(new NotebookEventDispatcher()); </ins> this._viewContext = new ViewContext( this._notebookOptions, <del> new NotebookEventDispatcher(), </del> <ins> eventDispatcher, </ins> language => this.getBaseCellEditorOptions(language)); this._register(this._viewContext.eventDispatcher.onDidChangeCellState(e => { this._onDidChangeCellState.fire(e); })); this._overlayContainer = document.createElement('div'); <del> this.scopedContextKeyService = contextKeyService.createScoped(this._overlayContainer); </del> <ins> this.scopedContextKeyService = this._register(contextKeyService.createScoped(this._overlayContainer)); </ins> this.instantiationService = instantiationService.createChild(new ServiceCollection([IContextKeyService, this.scopedContextKeyService])); this._register(_notebookService.onDidChangeOutputRenderers(() => {