dotnet / dotnet/wpf

WPF DataGrid memory leak

Open
#6,087 38 comments 3 reactions 1 assignee Claimed by @gurpreet-wpf View on GitHub
:construction: work in progress Performance
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

**Problem description:**
I originaly thought this was issue of ReactiveUI:
https://github.com/reactiveui/ReactiveUI/issues/3178

but it turns out it is issue with WPF somewhere.

This issue exists for me on VS 2022, VS2019, no matter if it is debugger or not, NET5, NET6, NET CORE 3.1

**Actual behavior:**
Objects are not getting garbage collected after removing them from ObservableCollection which is bound to DataGrid.ItemsSource

**Expected behavior:**
Should not leak

**Minimal repro:**
I have built repository showcasing the issue (Branch without ReactiveUI and project ReactiveUI_DataGrid_MemoryLeak):
https://github.com/tomasfil/ReactiveUI_Tests/tree/WithoutReactiveUI/ReactiveUI_DataGrid_MemoryLeak

The demo logic is at MainWindow.xaml.cs
Just run the project. The cycle will stop after 15 seconds.

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.