Skip to content

fix: memory leak with subdecorations not being disposed#278328

Merged
hediet merged 2 commits intomicrosoft:mainfrom
SimonSiefke:fix/decorations2
Nov 26, 2025
Merged

fix: memory leak with subdecorations not being disposed#278328
hediet merged 2 commits intomicrosoft:mainfrom
SimonSiefke:fix/decorations2

Conversation

@SimonSiefke
Copy link
Contributor

Fixes a memory leak with subdecoration types not being disposed when a decoration type is disposed.

Before

When registering / unregistering decorations for example by toggling git inline blame, the number of CSS rules seems to grow by one each time.

Toggling git inline blame 97 times, the number of CSS rules grows by 97:

css-rule-count

The added CSS rules all look like this:

{
  "cssRules": {
    "leaked": [
       /* many more */
      ".monaco-editor .ced-1-TextEditorDecorationType142--92456b-4.ced-1-TextEditorDecorationType142-4::after { content: \"first commit\"; margin: 0px 0px 0px 50px; }",
      ".monaco-editor .ced-1-TextEditorDecorationType127--92456b-4.ced-1-TextEditorDecorationType127-4::after { content: \"first commit\"; margin: 0px 0px 0px 50px; }",
      ".monaco-editor .ced-1-TextEditorDecorationType112--92456b-4.ced-1-TextEditorDecorationType112-4::after { content: \"first commit\"; margin: 0px 0px 0px 50px; }",
      ".monaco-editor .ced-1-TextEditorDecorationType97--92456b-4.ced-1-TextEditorDecorationType97-4::after { content: \"first commit\"; margin: 0px 0px 0px 50px; }",
      ".monaco-editor .ced-1-TextEditorDecorationType82--92456b-4.ced-1-TextEditorDecorationType82-4::after { content: \"first commit\"; margin: 0px 0px 0px 50px; }",
      ".monaco-editor .ced-1-TextEditorDecorationType67--92456b-4.ced-1-TextEditorDecorationType67-4::after { content: \"first commit\"; margin: 0px 0px 0px 50px; }",
      ".monaco-editor .ced-1-TextEditorDecorationType52--92456b-4.ced-1-TextEditorDecorationType52-4::after { content: \"first commit\"; margin: 0px 0px 0px 50px; }"
    ]
  },
  "isLeak": false
}

After

No more leak is detected.

@SimonSiefke SimonSiefke changed the title fix: memory leak in decorations fix: memory leak in subdecorations not being disposed Nov 19, 2025
@SimonSiefke SimonSiefke changed the title fix: memory leak in subdecorations not being disposed fix: memory leak in subdecorations, not being disposed Nov 19, 2025
@SimonSiefke SimonSiefke changed the title fix: memory leak in subdecorations, not being disposed fix: memory leak in subdecorations not being disposed Nov 19, 2025
@SimonSiefke SimonSiefke changed the title fix: memory leak in subdecorations not being disposed fix: memory leak with subdecorations not being disposed Nov 19, 2025
@hediet hediet enabled auto-merge (squash) November 24, 2025 16:49
@hediet
Copy link
Member

hediet commented Nov 24, 2025

Thanks for discovering and fixing this!

@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 24, 2025
@hediet hediet merged commit a5aacd6 into microsoft:main Nov 26, 2025
27 of 28 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 10, 2026
@SimonSiefke SimonSiefke deleted the fix/decorations2 branch January 15, 2026 15:04
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.

4 participants