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

Question: Why does WinUI use so much memory? #4606

Closed
Noemata opened this issue Mar 22, 2021 · 13 comments
Closed

Question: Why does WinUI use so much memory? #4606

Noemata opened this issue Mar 22, 2021 · 13 comments
Labels
appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps area-C#/WinRT product-winui3 WinUI 3 issues question

Comments

@Noemata
Copy link

Noemata commented Mar 22, 2021

Based on the tests done here: https://github.com/Noemata/XamlBenchmark

WinUI uses vastly more memory than WPF or UWP. It also appears to leak memory resources to a significant degree.

For the same test WPF uses 100MB, UWP uses 45MB and WinUI tops out at 700MB without relinquishing most of what was taken.

Why?

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Mar 22, 2021
@mdtauk
Copy link
Contributor

mdtauk commented Mar 22, 2021

I think there was a mention of a few MB more memory as WinUI has to render to a Swapchain rather than the OS compositor layer.

@Noemata
Copy link
Author

Noemata commented Mar 22, 2021

@mdtauk , I suggest you have a look at the benchmark rather than speculate. WinUI is leaking a lot with exactly the same code used by UWP, and very similar code to WPF. Just one problematic detail. A 10x memory utilization increase over UWP is unsustainable. 45MB versus 700+MB is not a few MB difference!

We need more hard facts and less speculation in these discussions. It's like the Pivot discussion, no facts just a lot of speculation and unsubstantiated declarations, when it would be very easy for Microsoft to publish stats of usage on GitHub or concrete details about development resources required for supporting a given feature.

@Noemata
Copy link
Author

Noemata commented Mar 22, 2021

What's also noteworthy, Microsoft is not reaching out to the community for support. The Pivot control just happens to be a really good example of that. Microsoft could have given the code and styles out to the community, as is. We would have happily taken on the task of updating the styles and improving the code for reintegration were it truly such a large resource drain for Microsoft. @mdtauk , I commend you for trying to do just that! Obviously, Microsoft internal politics, motivations and objectives were more important criteria to appease than the needs of UWP/WPF developers.

I don't think the community can help itself beyond shining a light on what's important until Microsoft decides to be Open (Source). @mdtauk , we're the fifth wheel.

@StephenLPeters
Copy link
Contributor

I suspect that a big portion of this is the known C#winrt leak. @Scottj1s

@StephenLPeters StephenLPeters added area-C#/WinRT appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps product-winui3 WinUI 3 issues and removed needs-triage Issue needs to be triaged by the area owners labels Mar 22, 2021
@vitordelucca
Copy link

I'll be missing .NET Native a lot...

@mdtauk
Copy link
Contributor

mdtauk commented Mar 23, 2021

@mdtauk , I suggest you have a look at the benchmark rather than speculate. WinUI is leaking a lot with exactly the same code used by UWP, and very similar code to WPF. Just one problematic detail. A 10x memory utilization increase over UWP is unsustainable. 45MB versus 700+MB is not a few MB difference!

We need more hard facts and less speculation in these discussions. It's like the Pivot discussion, no facts just a lot of speculation and unsubstantiated declarations, when it would be very easy for Microsoft to publish stats of usage on GitHub or concrete details about development resources required for supporting a given feature.

I wasn't doubting your findings, just adding that the team has mentioned a slight increase, so that is what we should be expecting, not the 10 times increase you are seeing.

@Noemata
Copy link
Author

Noemata commented Mar 23, 2021

@mdtauk , looks like I've gotten a tad too accustomed to pushback from one specific source. Sorry for the reactionary reply.

@asklar
Copy link
Member

asklar commented Mar 25, 2021

if you're seeing these numbers from C# it's likely to be the cswinrt leak

@Noemata
Copy link
Author

Noemata commented Mar 25, 2021

@asklar , hopefully it's just that. The working set seems significantly bigger too (cursory observation). We'll see. It's easy to compare with this benchmark, so the next release of WinUI should be significantly better on perf and memory footprint.

@Noemata
Copy link
Author

Noemata commented Mar 31, 2021

@StephenLPeters , any word on when this will get resolved? The GA release is still leaking memory in a big way.

@angelazhangmsft
Copy link
Contributor

@Noemata the memory leaks have been fixed in C#/WinRT 1.2, and will be part of an upcoming update.
microsoft/CsWinRT#413

@Noemata
Copy link
Author

Noemata commented Apr 6, 2021

@angelazhangmsft , fantastic!

@akilarajesh1313
Copy link

This issue has been resolved, see: microsoft/CsWinRT#413

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps area-C#/WinRT product-winui3 WinUI 3 issues question
Projects
None yet
Development

No branches or pull requests

7 participants