Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF UI Thread Slowdown

$
0
0

Hi - I've written a fairly rich graphical application for one of our company's products, and I'm encountering a very strange issue that I'm hoping someone might have some insight into.  This is a bit esoteric, so if you need any additional information, please don't hesitate to ask.

Background

The UI has many images and animations (some non-stop, others created very regularly).  This runs on a large touch screen that people interact with.  I've ruled out interaction as a cause for the UI thread, as I have an identical setup locally that I let sit for several hours before the problem surfaced.

Symptoms

After several hours of running, the UI thread slows down considerably.  Background threads continue running as expected, but the UI becomes slower and slower and, ultimately, nearly unresponsive.  I've debugged it and found that when things are slowing down, the UI thread is hanging on the following call:

System.Windows.Media.Animation.WeakRefEnumerator<System.Windows.Media.Animation.Clock>.MoveNext()

Memory slowly grows (in about 5 hours, memory consumption increased by 90MB), though we do have some small feeds that come in and get rendered.  I know that these feeds could not account for 90MB in that amount of time, however.

So - my question: Why is this weak ref enumerator slowing down so much?  Am I missing something in how animations (such as a DoubleAnimation) should be used in XAML or in C#, and am not properly disposing of something or cleaning something up?  Most of the animations are defined in XAML, so I'm not sure what I could even do about those, if anything.  One animation, in particular, is defined and Clone()'d every few seconds (the animation lasts only 750ms, though), so I don't know if this is something that is causing a memory-leak like condition that is also causing this weak ref enumerator to get hung up on a huge list of animations that isn't shrinking.

Any insight would be most appreciated.

Thank you!


Viewing all articles
Browse latest Browse all 18858

Trending Articles