Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Memory leak when disposing Krypton.Toolkit.PaletteBase and derived classes. #2104

Open
MarthinusR opened this issue Jan 27, 2025 · 1 comment
Labels
area:toolkit All issues related to the toolkit components. bug Something isn't working regression Something was working in a previous release, but isn't working now. version:90 All things to do with V90. version:95 All things to do with V95. version:100 All things to do with V100.
Milestone

Comments

@MarthinusR
Copy link

Describe the bug
The class "Krypton.Toolkit.PaletteBase" does not unsubscribe its "OnUserPreferenceChanged" method from the static rooted event "SystemEvents.UserPreferenceChanged", leading to objects persistently maintained in second generation garbage, i.e. memory leaks.

Derived classes also instantiate member controls that do not get disposed and become dangling objects.

To Reproduce
Steps to reproduce the behavior:

  1. Start the "TestForm" project.
  2. Click on "Buttons" to open the "ButtonsTest" form.
  3. Click on the close button.
  4. "PaletteBase" objects will not be collected on close.

Expected behavior
All "PaletteBase" objects must be garbage collected.

Screenshots
Image

Desktop:

  • OS: Windows 11
  • Version: 10.0.22621
  • Framework/.NET Version: 4.7.2
  • Toolkit Version: 90.25.1.27

Additional context
Some work has been done (Krypton_memory_fix.patch) to clean up resources, but due to unfamiliarity with the project it is unclear who the oner of created objects are. KryptonReadOnlyControls espesially is a point of concern and should be addressed. The provided patch might not be stable.

@MarthinusR MarthinusR added the bug Something isn't working label Jan 27, 2025
@PWagner1 PWagner1 added regression Something was working in a previous release, but isn't working now. area:toolkit All issues related to the toolkit components. version:90 All things to do with V90. version:100 All things to do with V100. version:95 All things to do with V95. labels Jan 27, 2025
@PWagner1 PWagner1 added this to the Version 95 milestone Jan 27, 2025
@PWagner1 PWagner1 assigned PWagner1 and unassigned PWagner1 Jan 27, 2025
@giduac
Copy link
Contributor

giduac commented Jan 30, 2025

Discussion opened on the KDev server to review this proposal:
https://discord.com/channels/1261930150585569350/1333697703154286652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:toolkit All issues related to the toolkit components. bug Something isn't working regression Something was working in a previous release, but isn't working now. version:90 All things to do with V90. version:95 All things to do with V95. version:100 All things to do with V100.
Projects
None yet
3 participants