-
Notifications
You must be signed in to change notification settings - Fork 693
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
Memory leak in WinUI3 multiple window applications #9063
Comments
A workaround is to not use x:bind in your bindings and to manually unwire all event handlers even those done in XAML. This will allow the window to be properly garbage collected. |
@NicholasChrzan |
This should got more attention. It's still leaking in Winui3 1.5. Dismissing the window does not release a single bit of memory. Can reproduce simply with the official WinUI 3 Gallery app in the |
Can this be fix? |
Even explorer.exe have this problem |
Explorer is very bad, memory usage grows to around a gigabyte with time and a bunch of threads |
Still happening to this day in dotnet8, even in empty windows. |
I have the same problem in my project that has already been launched in production. Does anyone have a workaround? |
You can reproduce this by switch between two tabs in WinUI3 Gallery app.But there is no such problem in winui2 Gallery . |
UWP is also affected by |
Hi @marcelwgn , do you or any teammates have any idea on this issue please? thanks. |
I tested the project in the initial post and with updated packages, I could only observe an increase of less than 1Mb if the 50 windows are opened and closed repeatedly. However, it seems that Visual Studio shows an inflated memory usage if xaml hot reload is enabled. I also put some more observations here #9960 that might lead to additional memory leaks. |
Describe the bug
The memory is not released after dismissing WinUI 3 windows. Consider a WinUI3 app that creates multiple XAML windows on a button click. Each time a window is created, the memory usage increases. But memory usage is not decreasing when dismissing the windows.
Steps to reproduce the bug
https://learn.microsoft.com/en-us/windows/apps/winui/winui3/create-your-first-winui3-app#unpackaged-create-a-new-project-for-an-unpackaged-c-or-c-winui-3-desktop-app
Expected behavior
When each window is closed, the memory use should be reduced.
Screenshots
No response
NuGet package version
Windows App SDK 1.4.2: 1.4.231008000
Packaging type
Unpackaged
Windows version
Windows 10 version 22H2 (19045, 2022 Update)
IDE
Visual Studio 2022
Additional context
A sample application with above described issue is also attached.
MemoryTest.zip
How do we fix this issue?
Is there any workaround available to fix this issue?
Any help would be highly appreciated.
The text was updated successfully, but these errors were encountered: