Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Fix memory leak w/ main window #24176

Merged
merged 1 commit into from
Aug 13, 2024
Merged

[Windows] Fix memory leak w/ main window #24176

merged 1 commit into from
Aug 13, 2024

Conversation

Foda
Copy link
Member

@Foda Foda commented Aug 12, 2024

Description of Change

Fix memory leak w/ main window by unsubscribing to events.

Issues Fixed

Fixes #24102

@Foda Foda added platform/windows 🪟 memory-leak 💦 Memory usage grows / objects live forever labels Aug 12, 2024
@Foda Foda requested a review from a team as a code owner August 12, 2024 22:22
@Foda Foda changed the title Fix memory leak w/ main window [Windows] Fix memory leak w/ main window Aug 12, 2024
@@ -87,6 +87,9 @@ private void OnClosedPrivate(object sender, UI.Xaml.WindowEventArgs args)
{
OnClosed(sender, args);

Activated -= OnActivated;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a bunch of trial and error, this was the solution to getting the weak reference to be marked not-alive.

@jingliancui
Copy link
Contributor

hi, if this fix pass this issue sample app? #24140

@rmarinho rmarinho merged commit 7d55d06 into main Aug 13, 2024
97 checks passed
@rmarinho rmarinho deleted the foda/windowleak branch August 13, 2024 10:09
@samhouts samhouts added fixed-in-net9.0-nightly This may be available in a nightly release! fixed-in-net8.0-nightly This may be available in a nightly release! labels Aug 27, 2024
@samhouts samhouts added fixed-in-9.0.0-rc.1.24453.9 and removed fixed-in-net9.0-nightly This may be available in a nightly release! fixed-in-net8.0-nightly This may be available in a nightly release! labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] MauiWinUIWindow leak
5 participants