question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

https://user-images.githubusercontent.com/17767561/118251665-8b585d80-b4b0-11eb-995f-ee2df025bf8c.mp4

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:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
weltkantecommented, May 19, 2021

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

There may be more things leaking, but disposing the ImageList before reassigning it helps fixing at least some of the leaks.

2reactions
Ashley-Licommented, May 28, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found