This is a migrated thread and some comments may be shown as answers.

RadBusyIndicator leaks if never visible

3 Answers 103 Views
BusyIndicator
This is a migrated thread and some comments may be shown as answers.
StackOverflowed
Top achievements
Rank 1
StackOverflowed asked on 02 May 2011, 08:54 PM
In short, if a control template uses triggers with enter/leave actions affecting a UIElement which is collapsed, WPF will leak that UIElement (complete specifics can be found here: http://blog.ramondeklein.nl/index.php/2009/02/20/memory-leak-with-wpf-animations/). Briefly, what happens is that if the item is collapsed, the enter/exit actions will not actually occur, but will be placed in a "DeferredActions" table in the template itself. If the UIElement is never shown, then these deferred actions won't be evaluated, and they'll remain as strong references to the the still collapsed UIElement.

In our case, this happens with the template for the RadBusyIndicator, which amongst other things, sets a ControlTemplate for the RadProgressBar it contains. The "IndeterminateDonut" UIElement in the RadProgressBar is initially Collapsed, even though there are Enter/Exit actions for animating it to continually go in a circle. Now this doesn't seem to be a problem when the BusyIndicator actually shows up at some point. However, when the RadBusyIndicator doesn't show up at any point during a Window's lifetime, and then the window is closed, we manifest the same exact problem as described above.

The fix was to grab the default ControlTemplate for the RadBusyIndicator, and change the initial visibility of the RadProgressBar to Hidden instead of Collapsed, so those actions can be evaluated. I haven't tested if this affects animation performance, however. As the link describes, this is fixed in WPF 4 using the ConditionalWeakTable to keep weak references to the elements which deferred actions will affect.

3 Answers, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 06 May 2011, 06:55 AM
Hello,

Thank you for the detailed explanation. We will try to workaround the issue. Probably we will make the busy donut Opacity="0" by default and set the Collapsed value on loaded or something like that so the triggers may be generated.

All the best,
Pana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
StackOverflowed
Top achievements
Rank 1
answered on 06 May 2011, 02:23 PM
As I said in my previous post, I've set it to Hidden and haven't seen any issues so far. FYI
0
Pana
Telerik team
answered on 11 May 2011, 04:27 PM
Hello StackOverflowed,

The Content property of the preload bar can be customized so if a long text is put there it may stretch the content even if the loader is hidden. I do not think that such problems would occure but we will have to put some tests. We will still fix the memory leak.

Regards,
Pana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
BusyIndicator
Asked by
StackOverflowed
Top achievements
Rank 1
Answers by
Pana
Telerik team
StackOverflowed
Top achievements
Rank 1
Share this question
or