-
Notifications
You must be signed in to change notification settings - Fork 677
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 NavigationView even though I cleared the child page element while unloading. #5978
Comments
I also inspected this issue several days ago, the mem usage and heap analysis was similar to yours. |
My case with this issue is more severe that what's inside the |
On my side, I just use Simple reproduction: https://discord.com/channels/372137812037730304/580484525075857428/902663747091460147 |
Hi Team, Any update on this? |
I have the same problem with .NET 6 and Windows App SDK 1.0. The memory is not released after I leave a page, and when I come back it's increasing with the amount needed for the page. If the memory needed for that page is 50 MBs, each time I navigate back and forth, it keeps increasing with 50 MBs. The page constructor is never hit.
|
Even when NavigatioView is used with controls (and not with a Page), the memory used by these controls will not be released after closing the NavigationView. I tested with the NavigationView in its own UserControl. On 'navigation', I set the Visibility of UI elements in a to Visible and Collapsed. So no actual navigation occurs. |
Any update? |
Unfortunately app still leaks memory, but it seems to be a WinUI 3 deficiency as there are other examples of this: microsoft/microsoft-ui-xaml#5978 microsoft/CsWinRT#1213
It should be fixed in the latest WindowsAppSDK version. I tested navigating back & forth and it's indeed increasing the memory but for my app it stops at around 500 MB of RAM. As far as I know there is a cache limit until which no memory will be released, so probably that's why it's still increasing. |
Is this issue not a high priority? "WinUI 3 Gallery" and "PowerToys" also has this problem(WinAppSDK: 1.2). |
Any news on this? Otherwise, where can I look to get updates for this? Created a WinUI 3, version 1.3, app with the template studio under win 11 and memory is increasing after each menu change. |
@vfib memory usage still increase when more than 500 MB, but the growth will slow down. if you continue navigation, your app will crash. (tested with WinAppSDK 1.3) Powertoys can be used for testing, navigated to difference page many times, Powertoys will crash. Temporary solutions is: private void ContentFrame_Navigated(object sender, NavigationEventArgs e)
{
System.GC.Collect();
} |
@l619534951 Yeah, there seem to be some problems with navigation right now. Offtopic, but setting a ThemeResource to create a card like stackpanel in settings page causes my app to crash under certain circumstances after third navigation back and forth. But thanks for that workaround! |
Years later this is still an issue from UWP days... Is this something that can actually be solved? Or should we rather undertake the massive effort to move our years-in-the-making application to a different platform? |
We've made leak fixes in the recent 1.4 WASDK release. Please give the latest build a try and let us know if this is still an issue. Memory growth is expected until GC kicks in. If you see unbounded growth or leak in a native app, please let us know. |
@ranjeshj |
It really is a great misfortune that such a central function as navigation still does not work without errors. It is not possible to develop professional applications with the WinAppSdk in its current state. The memory leak in the navigation in combination with the use of the WebView2 control (a new instance is created with every page change) causes every application to crash after a few days of use. |
The official clock app |
Is there any news on this? It still seems to be occurring with WinApp 1.5 (and .NET 8) with a sample app I created. |
Confirmed also with VS 17.10 |
Still reproducible with latest WinUI3 Gallery. Spawning additional windows from "Multiple Windows" menu and closing them not releases memory to initial state. 3 years and issue still not addressed.... |
Discussion: Why memory leak occurs while displaying a custom code snippets view in a NavigationView's child page.
Describe the bug
While using the
NavigationView
control to navigate child pages, the child page's elements were cleared in its own unloading methods. But, the child pages retaining their memory after closing them.Steps to reproduce the bug
Debug
menu item and select thePerformance Profiler
in Visual studio.Memory Usage
check box and clickStart
buttonTakeScreenshot
button in the Visual Studio diagnostic session.DemoList
Navigation Menu Item in the application.Code Snippets1
grid view item and its opens a code snippets pageBack
app bar buttonCodeSnippets 2
andCodeSnippets 3
Empty Page
Navigation Menu Item.Force GC
in the Visual Studio diagnostic session.TakeScreenshot
button in the Visual Studio diagnostic session.Stop Collection
Memory leak report:
Expected behavior
Memory should be the same or low as the initial screenshot.
Version Info
NuGet package version: [WinUI 3 - Windows App SDK 0.8: 0.8.1]
Windows app type
WinRT
Windows version
October 2020 Update (19042)
Related Links
The text was updated successfully, but these errors were encountered: