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

Memory leak during page navigation with ListViews #1213

Open
manodasanW opened this issue Jun 29, 2022 · 14 comments
Open

Memory leak during page navigation with ListViews #1213

manodasanW opened this issue Jun 29, 2022 · 14 comments
Labels
bug Something isn't working

Comments

@manodasanW
Copy link
Member

Find attached two demo projects, the "UIOnly" folder contains the example from this issue comment, ported to the latest project template.
Additionally, the "MVVM" folder contains an example that is similar to what I try to build in my application. I had to click back and force for a long time and some memory gets freed sometimes, but the app will crash eventually.
image

Hope that helps and thanks for looking into it.

PoC.zip

Originally posted by @marcpiechura in #413 (comment)

@TheAvonian
Copy link

Hi, I created a project using the starter WinUI3 template provided by Visual Studio.
Here it is.
I also provided a gif demonstrating how every navigation adds a MB and it never stops nor gets collected.
2022-06-29_19-28-01
This is on .NET 6.0.300, template used was navigation pane with a settings page, MSIX packaging, and MVVM structure.
This is also demonstrated via the newest WinUI 3 Gallery update from the Microsoft Store, clicking a new navigation tab adds several MB every time.

@brandon3343
Copy link

Hi, I created a project using the starter WinUI3 template provided by Visual Studio. Here it is. I also provided a gif demonstrating how every navigation adds a MB and it never stops nor gets collected. 2022-06-29_19-28-01 2022-06-29_19-28-01 This is on .NET 6.0.300, template used was navigation pane with a settings page, MSIX packaging, and MVVM structure. This is also demonstrated via the newest WinUI 3 Gallery update from the Microsoft Store, clicking a new navigation tab adds several MB every time.

has the same problem, operation similar to yours.(also appears when navigation stack is disabled)
repo: https://github.com/l619534951/NavMemLeak
I don't know whose problem it is, then I created issue in microsoft-ui-xaml microsoft/microsoft-ui-xaml#7322

bdach added a commit to bdach/ToDoList that referenced this issue Sep 11, 2022
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
@christosk92
Copy link

christosk92 commented Sep 21, 2022

Along with rendering performance issues and the consistent memory leakages. WinUI3/WinAppSdk has been performing really badly since its release. Can we expect any significant improvements in both rendering & memory? Or should we switch to web dev?

@KWodarczyk
Copy link

is there any workaround for this while we wait for the fix ? I am surprise this has not been fix yet as this affects everyone using this framework. Even WinUI 2 Galery has this issue. Come on.

@asierpn
Copy link

asierpn commented Oct 25, 2022

We have migrated our UWP app to WinUI3/WinAppSdk and all our users are reporting a significant performance improvement, there are still memory leaks in navigation, but in our stress tests they do not appear as early as they did in UWP. This team is doing a good job but these remaining issues need to be addressed soon, the navigation memory leaks have been present on this platform since its early days.

@christosk92
Copy link

For now I went ahead and implemented ContentControl navigation instead of Frame navigation. Manually disposing/getting rid of UserControl (instead of pages) seems to be doing the trick for now.

@brandon3343
Copy link

For now I went ahead and implemented ContentControl navigation instead of Frame navigation. Manually disposing/getting rid of UserControl (instead of pages) seems to be doing the trick for now.

Try Windows App SDK 1.2.0-preview2, It fixes many problems. (The memory leak of listview is fixed, but I haven't tested Frame)

@bogdan-patraucean
Copy link

@l619534951 I'm using it, it's not fixed.

@bogdan-patraucean
Copy link

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.

@christosk92
Copy link

christosk92 commented Dec 18, 2022

Yes it has been fixed. Memory does no longer increase beyond a certain threshold (I believe this is dependent on the System configuration and automatically adapts).

I believe WinAppSdk is heading in the right direction with the latest improvements in rendering. But scrolling still isn't as smooth as UWP, but I believe this will be fixed in a future release.

I already have a much better experience with my app using WinAppSDK than with UWP, no sudden crashes, ListView/ItemsRepeater renders are much faster etc.

Well done to the team.

@Reza-Noei
Copy link

I have still this issue.

@christosk92 my application runs with 110mb memory usage, I have several charts and after doing some navigation and loading some charts it goes to 2gb and more.

Is this certain threshold you mentioned above may goes higher than this or I should be hopeful to see it stop growing somewhere ?

@soroshsabz
Copy link

@christosk92 Which version resolved this problem?

@marcelwgn
Copy link

@manodasanW I think this issue is not only related to ListView (maybe rename this issue?) and I also would argue it is not really fixed. Apps like Files or the WinUI Gallery still have issues with massive memory consumption.

Attached is a simple repro project: NavigationMemoryLeak.zip

@soroshsabz
Copy link

@manodasanW any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants