Skip to content

fix: memory leak in notebook view model - #328208

Merged
dmitrivMS merged 3 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-notebookViewModel
Jul 31, 2026
Merged

fix: memory leak in notebook view model#328208
dmitrivMS merged 3 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-notebookViewModel

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

Deleted notebook cell view models stayed reachable through NotebookViewModel's disposable store after their cells were removed.

Change

Remove deleted cell view models from the disposable store, which also disposes them immediately.

Before

When splitting and joining a notebook cell 37 times, CodeCellViewModel grows once per iteration:

before

After

No more CodeCellViewModel leak is detected.

after

Test Video

notebook-cell-split.webm

Copilot AI review requested due to automatic review settings July 30, 2026 12:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes retention of deleted notebook cell view models by removing and disposing them from the notebook view model’s disposable store.

Changes:

  • Dispose and unregister deleted cell view models.
  • Add regression coverage verifying disposal occurs exactly once.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
notebookViewModelImpl.ts Removes deleted cells from the disposable store.
notebookViewModel.test.ts Tests immediate disposal without repeated teardown disposal.

@meganrogge meganrogge added this to the 1.132.0 milestone Jul 30, 2026
@dmitrivMS

Copy link
Copy Markdown
Contributor

@SimonSiefke thank you!

@dmitrivMS
dmitrivMS enabled auto-merge (squash) July 31, 2026 00:54
@dmitrivMS
dmitrivMS merged commit b9b1422 into microsoft:main Jul 31, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants