dotnet / dotnet/wpf

Memory leaks on open window

Open
#9,331 5 comments 0 reactions 0 assignees View on GitHub
:mailbox_with_no_mail: waiting-author-feedback needs more information
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

WPF windows seem to cause memory leaks.
Each time a window is opened, the RAM increases but does not decrease when the window is closed.
If a window contains lots of controls, the memory can quickly increase to several GigaBytes.
It seems that after closing the window, the application remembers Bindings and weakreferences to controls.

### Reproduction Steps

Create an WPF application with a button which open a dialog (modal or not modal) window.
This window contains 1000 textboxes (created dynamically in constructor).
Open and close this windows several times.

### Expected behavior

RAM decrease when we close window (same RAM before closing)
Garbage collector is called when we close window.

### Actual behavior

RAM increases every time I open the window and it hardly goes down when I close the window

### Regression?

_No response_

### Known Workarounds

_No response_

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