Skip to content

fix: memory leak in notebook attachment diagnostics - #333383

Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-notebook-attachment-diagnostics
Sep 18, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 3 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-notebook-attachment-diagnostics

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

When notebook cells are removed or their text documents close, the attachment cleaner clears their image-attachment diagnostics but leaves the URI entries in the diagnostic collection. Closing a notebook has the same problem, so repeated split, merge, close, and reopen operations leave more empty entries behind.

Change

Delete each cell URI from the image-attachment diagnostic collection when the cell is removed, its text document closes, or the notebook closes.

Before

Across 37 notebook lifecycle iterations, named-function-count3 reports 74 ResourceMapEntry instances, an increase of 39, in the Notebook Image Attachment diagnostic collection.

notebook-before

After

No named-function leak rows are detected across 37 notebook split, merge, close, and reopen iterations.

Test Video

notebook-editor-lifecycle-churn.webm

Copilot AI balanced review requested due to automatic review settings August 30, 2026 08:09

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

Removes stale notebook image-attachment diagnostic entries during notebook and cell lifecycle events.

Changes:

  • Deletes diagnostics for removed cells.
  • Clears diagnostics when documents or notebooks close.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@meganrogge Megan Rogge (meganrogge) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@meganrogge

Copy link
Copy Markdown
Collaborator

Checks failing

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit b995b9f into microsoft:main Sep 18, 2026
33 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.139.0 milestone Sep 18, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/memory-leak-notebook-attachment-diagnostics branch September 20, 2026 07:39
Abdon Morales (abdonmorales) pushed a commit to abdonmorales/vscode-utcs that referenced this pull request Sep 23, 2026
* fix: dispose notebook attachment diagnostics

* fix: preserve diagnostics when moving notebook cells

---------

Co-authored-by: Dmitriy Vasyura <[email protected]>
(cherry picked from commit b995b9f)
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Nov 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants