Skip to content

fix: memory leak in mainThreadNotebook - #334189

Merged
Megan Rogge (meganrogge) merged 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-mainThreadNotebook
Sep 3, 2026
Merged

Megan Rogge (meganrogge) merged 1 commit into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-mainThreadNotebook

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

Notebook cell status bar providers are registered in the shared NotebookCellStatusBarService. When the extension host restarts, MainThreadNotebooks did not dispose those registrations, so each restart left a provider connected to the old main-thread customer.

Change

Dispose every cell status bar provider registration and clear the registration map when MainThreadNotebooks is disposed.

Before

When an extension with a notebook cell status bar provider is active and the extension host is restarted 37 times, the provider callback and its old main-thread customer grow once per restart:

before

After

No more matching leak is detected.

Test Video

restart-extension-host-7-runs.webm

Copilot AI balanced review requested due to automatic review settings September 3, 2026 07: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.

🟢 Approval recommended

The focused cleanup correctly addresses the leak and includes appropriate regression coverage.

Pull request overview

Fixes notebook cell status bar provider leaks after extension host restarts.

Changes:

  • Disposes and clears status bar provider registrations.
  • Adds regression coverage for cleanup behavior.
File summaries
File Description
mainThreadNotebook.ts Cleans up provider registrations on disposal.
mainThreadNotebook.test.ts Verifies registrations are disposed and removed.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

@meganrogge
Megan Rogge (meganrogge) merged commit c24222b into microsoft:main Sep 3, 2026
30 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 3, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/memory-leak-mainThreadNotebook 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 cell status bar registrations
(cherry picked from commit c24222b)
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