Skip to content

WPF window and images take massive amount of memory compared to UWP #3135

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

Open
teh173 opened this issue Jun 12, 2020 · 2 comments
Open

WPF window and images take massive amount of memory compared to UWP #3135

teh173 opened this issue Jun 12, 2020 · 2 comments
Labels
Performance Performance related issue
Milestone

Comments

@teh173
Copy link

teh173 commented Jun 12, 2020

  • .NET Core Version: 3.1.300
  • Windows version: 19041.329, but also reproducible in earlier versions
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No

Problem description:

A WPF window and image seem to take a massive amount of memory compared to an equivalently sized window in UWP.

Possibly related issues:

Minimal repro:

Test apps for WPF and UWP

WindowMemoryTestApps.zip

  1. Create a window
  2. (optional) Add an image element at the size of the screen. It just increases the memory usage even further than a blank window alone
  3. Resize the window to multiple monitors ( for example, 2 4Ks, or 1 4K monitor and other sized monitors)

Compare the memory usage in WPF vs. UWP

Actual behavior:
On my monitor setup with 7495 x 4440 virtual screen pixels, for WPF, sizing a window to that size takes around
image

This is what a similar setup looks like in UWP.
image

Expected behavior:
I would expect the behavior closer to UWP. I would expect say a (3840 x 2160 x 4 bytes per pixel) * 2 monitor setup to take 66,355,200 bytes, but WPF seems to be using many multiples of that.

Is this just an architectural limitation in WPF, or a bug?

@ryalanms ryalanms added the Performance Performance related issue label Oct 19, 2020
@ryalanms ryalanms added this to the Future milestone Oct 19, 2020
@simonjstanford
Copy link

simonjstanford commented Jan 28, 2021

We found that this was mainly an issue when debugging an app through Visual Studio and that disabling the in-app toolbar in the Live Visual Tree helped prevent this issue.

@baochenw
Copy link

baochenw commented Jun 4, 2021

It is not related to i-app bar. The issue could be reproducible with the template project.
Please refer to vedio in #4265
#4265 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Performance related issue
Projects
None yet
Development

No branches or pull requests

4 participants