dotnet / dotnet/wpf

Memory leak on some graphic cards

Open
#10,005 0 comments 3 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

[Here](https://github.com/ShannonZ/playground) is a minimal reproducible demo.
There is a **rapid memory increment after clicking the minimize button**. I've tested this problem with different graphic cards (integrated and discrete ). Until now, the following cards could reproduce the memory leak issue:

- NVIDIA GeForce GTX 1650
- NVIDIA GeForce GTX 3050
- NVidia Geforce GT 710
- ATI 6750
- Intel UHD 630 Graphics (integrated with i7-9700)

I've also tested the problem on different OSes (win10 LTSC2018-2022, win10 home, win 11 home) and .NET versions (framework 4.5 4.6 4.7 4.8, dotnet6 8). Unfortunately, all these software conditions have the same problem.

For Intel UHD 630, driver versions from old 27.x to the latest 30.x were tested, no help.

[3GB version dump file](https://drive.google.com/file/d/1QV4osqoLkoK2fmPcCp7qvhaWji63bejX/view?usp=sharing)

### Reproduction Steps

[This video](https://drive.google.com/file/d/1M__dGl626e1GMHajEe12PMH9UUJxCmIf/view?usp=sharing) is a step-by-step example demonstrating how to reproduce this issue.

### Expected behavior

There should be no memory leaks when running on different graphics cards.

### Actual behavior

Memory leaks occur when running on some graphics cards.

### Regression?

_No response_

### Known Workarounds

1. Comment the `WindowChrome` part out in Style could solve the leak problem. But I don't know why; (No minimization button, should press win+D to minimize the window)
![image](https://github.com/user-attachments/assets/14e0be46-aef9-4357-a817-699675dbc73d);
2. Using software-rendering;
3. Restore the window to the normal state, those memory would be "released". [Video](https://drive.google.com/file/d/1Rf1hP5xpFwYSGM7sCO4tXTM53WqmPjrJ/view?usp=sharing);
4. No obvious memory leak on NVIDIA Geforce RTX 4060 Laptop GPU, win 11

### Impact

_No response_

### Configuration

_No response_

### Other information

_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.