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

[Solved] Memory Leak in RadColorPicker

5 Answers 122 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dan
Top achievements
Rank 1
Dan asked on 03 Sep 2010, 01:45 AM
Using 2010.2.812.1040

Simply placing (and making visible at some point) a RadColorPicker on a page causes the entire visual tree of controls to become pinned in memory.  No custom templates, no property settings or event handlers.

From windbg:
DOMAIN(0B745520):HANDLE(Pinned):26512f8:Root:  09f2de80(System.Object[])->
  08f8ad84(System.Collections.Generic.Dictionary`2[[System.IntPtr, mscorlib],[System.Object, mscorlib]])->
  0ae098a0(System.Collections.Generic.Dictionary`2+Entry[[System.IntPtr, mscorlib],[System.Object, mscorlib]][])->
  092292f0(System.Windows.Controls.Grid)->
  09229354(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
  092293a0(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
  092291f4(System.Windows.Controls.Border)->
  09229258(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
  092292a4(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
  09228020(Telerik.Windows.Controls.RadColorSelector)->
  092294c8(System.EventHandler)->
  091147f4(Telerik.Windows.Controls.RadColorPicker)


For now, we can minize the issue by manually removing any RadColorPicker from our controls during Unloaded event.   Please advise when this issue is resolved.

5 Answers, 1 is accepted

Sort by
0
Viktor Tsvetkov
Telerik team
answered on 07 Sep 2010, 03:21 PM
Hello Dan,

Thank you for contacting us.
We are aware of this issue and it has reasonable explanation. There is a popup in the ControlTemplate of the RadColorPicker, in this popup there are custom databound properties and this causes the leak, but this is problem in the framework. We are currently trying to workaround this problem and we hope that there will be fix as soon as possible. I have updated your Telerik account.

Best wishes,
Viktor Tsvetkov
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
Dan
Top achievements
Rank 1
answered on 07 Sep 2010, 03:29 PM
As I understand the SL framework issue with templates, the pinning only occcurs when the template is defined inline in the page or usercontrol.  I have not seen any issue with the templates defined a theme or app level resource dictionary. 

What do you mean by 'custom databound properties'    I found a issue in radmap where the informationlayer was attaching to a dependancyproperty's propertychanged event (attaching a instance level handler to the static DP) which caused the issue.   We use custom DP's on on our controls and refer to them in the style templates on a regular basis without a leak.  I am curious what extra circumstance applies here so that we can avoid it also.

Regardless, it seemed like we had a similar problem with RadContextMenu which i have not written up -- assuming you're using the same popup logic i won't pursue if further.

In both cases, I've added a custom behavior via an Attached DP on the Unloaded event of the parent of the radcolorpicker or radcontextmenu to effectively null all of its databound properties and remove it from the visual tree which has mostly mitigated the issue.


0
Viktor Tsvetkov
Telerik team
answered on 07 Sep 2010, 03:40 PM
Hello Dan,

The problem occurs when the popup is placed in the ControlTemplate of another control and in the ContentPresenter of that popup exists custom DP that is template binded, as it is in the RadColorPicker.

Kind regards,
Viktor Tsvetkov
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
Dan
Top achievements
Rank 1
answered on 07 Sep 2010, 03:49 PM
I see.  Perhaps the issue could be avoided using a relativesource binding; or otherwise have the control deal with the unloaded event and remove the bindings. 
0
Viktor Tsvetkov
Telerik team
answered on 07 Sep 2010, 03:53 PM
Hi Dan,

We will investigate which is the most efficient approach and hopefully the fix will be available soon.

Best wishes,
Viktor Tsvetkov
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
ColorPicker
Asked by
Dan
Top achievements
Rank 1
Answers by
Viktor Tsvetkov
Telerik team
Dan
Top achievements
Rank 1
Share this question
or