Skip to content

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

@MarthinusR

Description

@MarthinusR

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolkitAll issues related to the toolkit components.awaiting feedbackA fix for this issue has been implemented, waiting for feedback on the fix.fixedThis issue has been fixed.version:105-ltsAll things to do with V105 LTS.version:85-ltsAll things to do with V85 LTS.version:90All things to do with V90.version:95All things to do with V95.💥 regressionSomething was working in a previous release, but isn't working now.🪲 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions