benruehl / adonis-ui

Lightweight UI toolkit for WPF applications offering classic but enhanced windows visuals
https://benruehl.github.io/adonis-ui/
MIT License
1.69k stars 143 forks source link

RippleHost causing MemoryLeaks #185

Open Zordiac opened 2 years ago

Zordiac commented 2 years ago

Describe the bug The RippleHost Eventhandlers do not get properly removed, causing references to already deleted objects to persist forever, and not being garbage collected.

To Reproduce Steps to reproduce the behavior:

  1. Create a new Adonis Window
  2. Add a ListView, add a Button as ListView.ItemTemplate (to have the ripple effect)
  3. Bind the List to an ObservableCollection with any Object
  4. Add a new Item to the List, and then remove it => Item stays in memory forever and is never garbage collected

Expected behavior Proper removal of all eventhandlers to allowed already removed objects to be garbage collected

*Additional Info Inspected using .net Memory Profiler

Zordiac commented 2 years ago

WpfApp2.zip

I created a sample app that reproduces that issue, just start it and wait, the memory will get more and more every second, even though the number of items displayed stays the same