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

[Solved] RadDropDownButton is leaking memory

6 Answers 194 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Simon Störmer
Top achievements
Rank 1
Simon Störmer asked on 04 Jun 2010, 11:00 AM
Hi Folks,

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&#x0B0;">  
                    </telerikNavigation:RadMenuItem> 
                    <telerikNavigation:RadMenuItem Header="Rotate left 90&#x0B0;">  
                    </telerikNavigation:RadMenuItem> 
                    <telerikNavigation:RadMenuItem Header="Rotate 180&#x0B0;" > 
                    </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.

 

 

 

6 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 04 Jun 2010, 04:47 PM
Hello Tobias Richling,

We are aware of the issue - it is a problem in the SL framework. Hopefully soon an update will be available that will fix the issue. We have contacted MS about that.

Best wishes,
Valentin.Stoychev
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
jonney xu
Top achievements
Rank 1
answered on 25 Sep 2010, 07:20 AM
Whether you guys have fixed this problem?
I have the same problem about RadDropDownButton in our project.
0
Miro Miroslavov
Telerik team
answered on 28 Sep 2010, 07:17 AM
Hi jonney xu,

 Yes, the memory leak problems are fixed. You can download the latest SP2 release and give it try.
Please let us know if you experience any problems or find any memory leaks.
Thank you.

Kind regards,
Miro Miroslavov
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
Chris
Top achievements
Rank 1
answered on 12 Jan 2011, 06:08 PM
Hi,

These problems still exists in Q3 (2010.3.1206.1040) unless I am mistaken. I have a RadDropDownButton being presented inside a RadWindow. The RadWindow is never garbage collected, regardless of how I try and clean up in the Closed event. If I remove the RadDropDownButton all is well:

<telerikSchema:RadDropDownButton x:Name="ActionButtons" Grid.Row="0" AutoOpenDelay="0" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3,3,0,3" Height="16" Width="16" Padding="0">
            <telerikSchema:RadDropDownButton.DropDownContent>
                <telerikSchema:RadContextMenu StaysOpen="False">
                    <telerikSchema:RadMenuItem Command="{Binding ViewModeCommand, Converter={StaticResource WeakCommandBindingConverter}}" CommandParameter="" Header="{Binding ViewMode, Converter={StaticResource ViewModeMenuConverter}}" IconTemplate="{StaticResource MenuIcon}" Icon="{Binding ViewMode, Converter={StaticResource ViewModeIconConverter}}" />
                </telerikSchema:RadContextMenu>
            </telerikSchema:RadDropDownButton.DropDownContent>
        </telerikSchema:RadDropDownButton>

Any help on this would be appreciated as I have spent a long time with WinDbg on this.

The output from WinDbg matches Tobias' output from the original post.

Kind Regards,
Chris Newton
0
Viktor Tsvetkov
Telerik team
answered on 17 Jan 2011, 05:49 PM
Hi Tobias Richling,

Please accept our apologies for the late reply, but we will need more time in order to investigate better this issue. We will write you back as soon as we have some results.

All the best,
Viktor Tsvetkov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Viktor Tsvetkov
Telerik team
answered on 19 Jan 2011, 05:02 PM
Hello Chris Newton,

We tried to reproduce the problem, but were not able to. Could please examine the attached sample project and follow the steps: click 3-4 times on the Add button, then click GC collect and then see how many are the live instances after clicking the button Live. You will see that the windows are removed and collected. So could please modify this example, if we are missing something, so it satisfies your requirements?

Kind regards,
Viktor Tsvetkov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
General Discussions
Asked by
Simon Störmer
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
jonney xu
Top achievements
Rank 1
Miro Miroslavov
Telerik team
Chris
Top achievements
Rank 1
Viktor Tsvetkov
Telerik team
Share this question
or