Repository navigation
fix: memory leak in color picker - #345461
Merged
Dmitriy Vasyura (dmitrivMS) merged 4 commits intoNov 4, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 4 commits into
Dmitriy Vasyura (dmitrivMS) merged 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the change to reuse color-picker pointer monitors.
No open issues 🎉
What changed in this PR
Fixes a memory leak in the editor color picker by reusing pointer monitors instead of retaining a new monitor after every drag.
Changes:
- Gives each saturation box, hue strip, and opacity strip one monitor, disposed with its control.
- Adds regression tests checking that repeated drags do not increase tracked disposables and still flush color changes.
| File | Description |
|---|---|
src/vs/editor/contrib/colorPicker/test/browser/colorPickerPointerMonitor.test.ts |
Tests repeated-drag resource cleanup and color flushing for all three controls. |
src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerStrip.ts |
Reuses one pointer monitor per hue or opacity strip. |
src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerSaturationBox.ts |
Reuses one pointer monitor and simplifies monitoring-state checks. |
Review effort: Balanced
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
November 4, 2026 20:49
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 4, 2026
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dirk Bäumer (dbaeumer)
approved these changes
Nov 4, 2026
roblourens
approved these changes
Nov 4, 2026
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
Each color picker drag adds a new pointer monitor to the control's disposable store. Ending the drag stops the monitor but does not remove it from the store, so repeated drags keep adding monitors until the color picker closes.
Change
Reuse one pointer monitor for each saturation box, hue strip, and opacity strip, and dispose it with the control.
Before
When running editor-color-picker-drag-color-area 37 times, GlobalPointerMoveMonitor grows by 111 instances:
After
No more leak detected.
Test Video
test-video.webm
AI disclosure: Model: GPT-6. Worktime: 8 min