Skip to content

fix: memory leak in debugModel - #327047

Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-debugModel
Jul 23, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 2 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-debugModel

Conversation

@SimonSiefke

@SimonSiefke Simon Siefke (SimonSiefke) commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Details

Disposes inactive child debug sessions when their root session is replaced.

Before

When debugging the same JavaScript file 37 times, inactive debug sessions, schedulers, cancellation tokens, and REPL models grow each time (outlined in red):

debug-javascript-before

After

No more leak is detected for these objects after debugging the same file 17 times.

Test Video

debug-javascript-test.mp4

Copilot AI review requested due to automatic review settings July 22, 2026 20:08

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 retained inactive child debug sessions when a root session is replaced.

Changes:

  • Adds root-session ancestry cleanup logic.
  • Adds regression coverage for disposing replaced session trees.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
debugModel.ts Disposes inactive descendants of replaced root sessions.
callStack.test.ts Tests replacement cleanup.

@dmitrivMS

Copy link
Copy Markdown
Collaborator

Simon Siefke (@SimonSiefke) Thank you!

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 8bcc12e into microsoft:main Jul 23, 2026
46 of 47 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.131.0 milestone Jul 23, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/memory-leak-debugModel branch July 28, 2026 16:51
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Sep 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants