fix: memory leak in dialog main service - #336019
Open
Simon Siefke (SimonSiefke) wants to merge 2 commits into
Open
Simon Siefke (SimonSiefke) wants to merge 2 commits into
Simon Siefke (SimonSiefke) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
Ulugbek Abdullaev (ulugbekna)
approved these changes
Sep 15, 2026
Ulugbek Abdullaev (ulugbekna)
enabled auto-merge (squash)
September 15, 2026 12:38
Giuseppe Cianci (Giuspepe)
approved these changes
Sep 15, 2026
Aiday Marlen Kyzy (aiday-mar)
approved these changes
Sep 15, 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 window that shows a native dialog gets its own queue in
DialogMainService. The queue is not removed after the dialog finishes and the window closes, so one queue remains for every window that has shown a dialog.Change
Remove a per-window dialog queue when all of its work has finished. Dialogs that overlap for the same window still share the queue and run in order.
Before
After 37 measured cycles of opening a window, invoking About, and closing the window,
named-function-count3reports 37 additionalQueueallocations. Heap retaining paths lead throughDialogMainService.windowDialogQueues. The outlinedQueuerow identifies the growth removed by this change.Both revisions use the same main-process scenario and a growth threshold of 37. The usual
async.tsandevent.tsexclusions are disabled so queue and emitter allocations are visible. Black bars show the initial count, red bars show growth, and labels show the final count.After
With the same 37 measured cycles,
Queuegrowth is 0. The raw heaps contain 2Queueinstances before and after, belonging to configuration editing and the no-window dialog queue. No queues remain retained throughwindowDialogQueues. Other event and storage allocations still grow and remain visible below.Test Video
test-video.webm