Repository navigation
fix: memory leak in marker resource maps - #346501
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits intoNov 6, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Missing regression tests for outer-index cleanup and retention of partially populated indexes through both changeOne and changeAll leave the leak undetectable by existing read() assertions.
1 open issue
What changed in this PR
Fixes retained empty maps in MarkerService by removing resource and owner keys after their final marker association is deleted.
Changes:
- Prunes empty entries from both backing indexes.
- Preserves entries that still contain associations.
| File | Description |
|---|---|
src/vs/platform/markers/common/markerService.ts |
Removes empty resource and owner entries during association deletion. |
Review effort: Balanced
Bryan Chen (bryanchen-d)
approved these changes
Nov 6, 2026
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 6, 2026
Bhavya U (bhavyaus)
approved these changes
Nov 6, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-marker-empty-maps
branch
November 11, 2026 10:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Details
Removing the final marker association leaves empty maps in both MarkerService indexes. Closed resources and disposed diagnostic collection names remain as keys after their markers have been cleared.
Change
Remove an outer resource or owner entry when its inner map becomes empty, preserving associations that still have markers.
Before
When creating, populating, and disposing diagnostic collections 17 times, the owner index keeps 17 additional empty maps and 612 bytes of collection-name strings. Total string growth is 920 bytes and 30 strings.
After
The owner index stays empty. Total string growth is 360 bytes and 13 strings over the same 17 cycles; the remaining runtime and UI changes stay visible. The 612-byte owner-name saving is separate from 52 bytes of other variation.
Test Video
marker-empty-maps-native.webm
AI disclosure: Model: GPT 6.1 Sol. Worktime: 10 min