Repository navigation
fix: memory leak in animation frame window disposal - #338263
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 20:43
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The cleanup correctly handles pending and active queues, with focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes animation-frame scheduler leaks when auxiliary windows close.
Changes:
- Clears per-window animation queues and state during unregistration.
- Safely ignores late frame callbacks and mid-frame window disposal.
- Adds lifecycle, cancellation, priority, and scheduling tests.
| File | Description |
|---|---|
src/vs/base/browser/dom.ts |
Cleans animation-frame state when windows unregister. |
src/vs/base/test/browser/animationFrame.test.ts |
Tests cleanup and scheduling behavior. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 28, 2026 04:20
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 28, 2026
Martin Aeschlimann (aeschli)
approved these changes
Sep 28, 2026
Christof Marti (chrmarti)
approved these changes
Sep 28, 2026
Dmitriy Vasyura (dmitrivMS)
merged commit Sep 28, 2026
86a5159
into
microsoft:main
55 of 56 checks passed
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-animationFrame-windowDisposal
branch
September 29, 2026 11:15
Abdon Morales (abdonmorales)
pushed a commit
to abdonmorales/vscode-utcs
that referenced
this pull request
Oct 1, 2026
Co-authored-by: Dmitriy Vasyura <dmitriv@microsoft.com> (cherry picked from commit 86a5159)
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
The animation-frame scheduler keeps queues and flags for each window in four global maps. Closing an auxiliary window leaves its entries behind. If the window closes before its next frame, canceled callbacks can also stay in its queue.
Change
Remove the closed window from all four maps and clear any queue currently being processed. Ignore a late frame callback after cleanup, and avoid recreating the running flag when a callback closes its own window.
Before
Opening and closing an auxiliary editor window 37 times grows each animation queue map from 3 to 40 entries. The chart shows all named-function growth rows.
After
Both animation queue maps stay at one entry for the live main window. Five unrelated named-function rows remain. The outlined menu rows disappear in this comparison, but their change has not been traced to this fix.
Test Video
test.mp4
AI disclosure: Model: GPT-6-Astra. Worktime: 14 min