dotnet / dotnet/wpf

High memory consumption or memory leak on Intel integrated graphics

Open
#7,704 57 comments 17 reactions 0 assignees View on GitHub
Investigate Performance
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

WPF application running on some Intel integrated graphics card is taking a lot more memory than it should. Even a pure empty WPF app takes 165.2 MB on startup.

![3aedc63e2047a93783dd15d5ac35848](https://user-images.githubusercontent.com/3304703/231039829-55775565-0d43-4026-b4b2-d687a9f401c3.png)

On other machine without Intel graphics, or disabling intel graphics card, or use software rendering, the memory consumption is normal.

![1ea5fdd519f495d74ada897df20fedb](https://user-images.githubusercontent.com/3304703/231039932-8886392a-7b09-493f-b0ce-32c2ec259798.png)

There are two threads on Intel community site describing the same issue. But I am not sure if this is a WPF issue or Intel issue.

https://community.intel.com/t5/Graphics/Net-WPF-Application-high-memory-consumption/td-p/1434020
https://community.intel.com/t5/Graphics/UHD710-High-memory-usage-and-memory-leak-issues-with-WPF/m-p/1471504

### Reproduction Steps

- Prepare a computer with i9-13900H CPU with Iris XE graphics (Other intel graphic may also have the issue)
- Install latest RTM driver 31.0.101.4255
- (Or) install latest beta driver 31.0.101.4257
- (Or) install old driver 31.0.101.4032 / 31.0.101.4091
- Create an empty WPF application with VS2022, .NET 6.0 or 7.0
- Publish the application using Release build
- Run the application
- Observe memory usage in task manager

### Expected behavior

Memory usage is around 10-30 MB

### Actual behavior

Memory usage is around 150 MB

### Regression?

_No response_

### Known Workarounds

Set the WPF app to use software rendering.

```csharp
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
}
}
```

### Impact

Users with some type of Intel graphics will have much more memory usage and potentially slow down their system.

### Configuration

- .NET 6.0 / 7.0
- Windows 11 Pro 22621.1485 x64

### Other information

#### This issue does not happen to

- i7-1185G7 with Intel Iris Xe Graphics (e.g. Surface Pro 8)
- i7-1065G7 with Intel lris Plus Graphics (e.g. Surface Laptop 3, Driver version 27.20.100.9621)
- i7-10700T with Intel UHD 630 Graphics (Driver version 31.0.101.2114)
- i7-8665U with Intel UHD 620 Graphics (Driver version 30.0.101.1404)

#### Attaching the WPF app used for testing this

[WpfApp1.zip](https://github.com/dotnet/wpf/files/11195882/WpfApp1.zip)

#### Memory consumption also has something to do with monitors:

- Using laptop screen only or just one external monitor: ~95MB (which is still considered to be abnormal)
- Using two external monitors: ~160MB
- Using laptop screen + two external monitors: ~245MB

It doesn't matter which screen the App is on, the more screens, the more memory usage.

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.