i have created a simple UserControl called MyControl containing the code from your RadDropDownButton Demo:
| <UserControl> |
| <Grid> |
| <telerik:RadDropDownButton x:Name="MenuDropDown" Padding="5" Grid.Row="3" Width="187" VerticalAlignment="Center" Content="Menu"> |
| <telerik:RadDropDownButton.DropDownContent> |
| <telerikNavigation:RadContextMenu Width="180" BorderThickness="0"> |
| <telerikNavigation:RadMenuItem Header="Rotate right 90°"> |
| </telerikNavigation:RadMenuItem> |
| <telerikNavigation:RadMenuItem Header="Rotate left 90°"> |
| </telerikNavigation:RadMenuItem> |
| <telerikNavigation:RadMenuItem Header="Rotate 180°" > |
| </telerikNavigation:RadMenuItem> |
| <telerikNavigation:RadMenuItem Header="Flip vertical"> |
| </telerikNavigation:RadMenuItem> |
| <telerikNavigation:RadMenuItem Header="Flip horizontal" > |
| </telerikNavigation:RadMenuItem> |
| </telerikNavigation:RadContextMenu> |
| </telerik:RadDropDownButton.DropDownContent> |
| </telerik:RadDropDownButton> |
| </Grid> |
| </UserControl> |
My root visual contains a button and a content presenter called content. Each time i press the button i run the following code:
MyControl c = new MyControl();
content.Content = c;
So each time i press the button, the RadDropDownButton insisde my control is detached from the visual tree and should hence be removed by gc. But if i take a look with windbg (running !DumpHeap -type RadDropDownButton) I find that the instances stick araound in memory - even after a call to GC.Collect().
The GCRoot output is:
DOMAIN(02C57638):HANDLE(Pinned):6a712f8:Root: 057c4260(System.Object[])->
047d8e9c(System.Collections.Generic.Dictionary`2[[System.IntPtr, mscorlib],[System.Object, mscorlib]])->
04906880(System.Collections.Generic.Dictionary`2+Entry[[System.IntPtr, mscorlib],[System.Object, mscorlib]][])->
048d3914(System.Windows.Controls.Grid)->
048d3978(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
048d39c4(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
048d2eb8(System.Windows.Controls.Border)->
048d387c(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
048d38c8(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
048d3254(System.Windows.Controls.ContentPresenter)->
048d34cc(System.Collections.Generic.Dictionary`2[[System.Windows.DependencyProperty, System.Windows],[System.Windows.EffectiveValueEntry, System.Windows]])->
048d3518(System.Collections.Generic.Dictionary`2+Entry[[System.Windows.DependencyProperty, System.Windows],[System.Windows.EffectiveValueEntry, System.Windows]][])->
048d3868(MS.Internal.ModifiedValue)->
048d36c8(System.Windows.Data.BindingExpression)->
048cdbcc(Telerik.Windows.Controls.RadDropDownButton)
As I use the DropDownButton within a large UserControl, the whole thing is prevented from being collected. Do I missunderstand windbg or is this an issue on your side?
Any help would be apprecitated!
Thanks in advance,
Tobias Richling.
