angelsix / fasetto-word

The new chat application for Fasetto, completely open-source :)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory Leak in FrameworkElementAnimationAttachedProperties

TomTomB opened this issue · comments

Hi there,

I think I´ve foud a memory leak in the "Animation stuff".

How did I achive this:
I created my own application with your YouTube series. It relies heavily on navigation through pages.
So, as soon as the user navigates to an other page, the old page should be destructed by the GC, but it´s not. It simply stays in the RAM.
I guess that´s due to some references in the FrameworkElementAnimationAttachedProperties.cs .
I think it´s propably the method that defines if the firstload flag is true or false.

I´ve also created a small application using PRISM to test if there is just a bug in my code, but that ended up with the same memory leak.

Cheers

Yes right now anywhere we do += to an event will contain memory leaks. I will clean this up with Weak Events soon or you can read up here https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/weak-event-patterns

Mhm I think that´s an other story. I´ve just figured out what the reason for my mentioned memory leak is.
But I don´t know how to properly fix that.

Inside AnimateBaseProperty<Parent> you´ve created 2 dictionaries storing all the Framwork Elements that got animation properties. Changing the types e.g. Dictionary<DependencyObject, bool> mAlreadyLoaded to Dictionary<string, bool> mAlreadyLoaded fixes my memory leak since from now on only the names of the Framework Elements are stored.

Again, I won´t use that as a solution - just thought it´s maybe some useful information.

Can you verify it is fixed here then I will close
d24cbc3

Hi,
yes it´s working perfectly fine now.
So I´ll guess this one can be closed.