[regression] PropertyGrid GDI leak
See original GitHub issue-
.NET Core Version: 5.0.3 - 5.0.6 tested.
-
Have you experienced this same bug with .NET Framework?: NO. Also this bug is not present in .net core 3.1
Problem description: For several months I am was investigating huge (up to critical 10000) GDI leak in our app (beginning after switching from .net core 3.1 to .Net 5). And finally found it out (I am happy 🙄). Facts:
- Leaking are DC and Bitmap in approximately the same proportions.
- This is not managed leaks - managed heap have not any increasing elements. So GC not helping here and if
PropertyGrid
inside childe window, closing it will not help too. - Leaks are not reproduce on local machine. Only when you connect to rdp session. So if your rdp session is open - all is fine, to leak you need close rdp window and connect again. Tested on Win10 1909/20H2 hosts.
I think amount of leaks are some how related to displaying property’s, because some window leak more than others.
Our scenario was: we have an mdi app with many child windows that’s have PropertyGrid
, for one rdp connect we losing about 100 GDI objects. So, after ~80 connects, our app was crushing. For now we monitor GDI objects count and restarting app when needed.
Expected behavior: No GDI leak.
Minimal repro: GDI_test.zip
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Is it possible to find out what is leaking GDI Objects
Is it possible to peek into it to see what would be leaking GDI Objects? A tree structured menu is leaking GDI Objects...
Read more >Smart PropertyGrid changelog
A very consuming GDI memory leak has been fixed. When setting a trackbar property to Readonly, the trackbar control was still visible and...
Read more >2011 v2 | WinForms Edition Release History
A GDI leak is no longer observed in an application using C1Editor. The cursor no longer gets placed at the end of the...
Read more >v12.2.0.0
Fixed : Regression with high DPI multimonitor handling for TAdvStringGrid ... Fixed : Memory leak in TAdvGroupBox; Fixed : Issue with column width ......
Read more >GDI Leaks: How to identify and fix them?
One leaked object per operation becomes a big leak. The second rule is: if a GDI object is selected to a device context,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
WM_SETTINGCHANGE
causes the PropertyGrid to reload its ImageList without disposing the old one, leaking the handles owned by it. When running a debug build you hit the assert. See also #4928 and #3567There may be more things leaking, but disposing the ImageList before reassigning it helps fixing at least some of the leaks.
Verified this issue with 6.0.100-preview.5.21276.14 from Release/6.0.1XX-preview5 branch of https://github.com/dotnet/installer, it is fixed. Please see this result: issue_4913_verify.zip