Repository navigation
fix: memory leak in composite drag and drop registrations - #338215
Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits intoSep 28, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
Conversation
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
September 27, 2026 17:43
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
All production callers retain and dispose the returned registrations, and the tests cover lifecycle regressions.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents process-lifetime retention of disposed composite drag-and-drop registration stores.
Changes:
- Returns registration stores directly to caller owners.
- Adds GC, disposal, and drag lifecycle regression tests.
| File | Description |
|---|---|
src/vs/workbench/browser/dnd.ts |
Removes observer ownership of per-registration stores. |
src/vs/workbench/test/browser/compositeDragAndDropObserver.test.ts |
Tests collection, disposal, and event behavior. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 28, 2026
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 28, 2026 11:02
Ladislau Szomoru (lszomoru)
approved these changes
Sep 28, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Sep 28, 2026
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-compositeDragDrop-registrations
branch
September 29, 2026 11:15
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 drag source or drop target registration adds its disposal store to the process-lifetime observer as well as returning it to the caller. Disposing the registration clears its callbacks but leaves the empty store and its Set in the observer.
Change
Return each registration store to its existing caller owner without adding it to the observer’s lifetime store. The caller continues to dispose its drag source or drop target normally.
Before
Toggling Modern UI on and off 37 times after warmup grows the observer’s disposed registration stores from 471 to 915. The full aggregate Set measurement below grows from 26,550 to 26,987 entries; it includes unrelated Sets too.
After
The same 37-cycle test leaves no registration stores in the observer. The full aggregate Set measurement stays at 26,051 entries, and overall DisposableStore growth falls from 447 to 4. Undo history and other object-shape differences remain. This fixes empty bookkeeping objects, not callbacks or widgets that disposal already released.
Test Video
Seven Modern UI enable/disable cycles in Settings after the same setup warmup.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 51 min