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

Possible memory leak with Rad Menu SubItems?

7 Answers 154 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 13 Jan 2016, 09:20 PM

Hello,
Recently we noticed that our product was not up for garbage collection when a user logged out, instead the entire product instance was held in memory. We've isolated it to what seems to be the RadMenu. Specifically the RadMenuItem when used as a SubMenuItem. This appears to happen either with RadMenuItems built in XAML, code behind, or binding to a collection with a template.

I have sample project to reproduce the issue but I couldn't attach it here. This occurs with the newest version 2016.1.112 and previous 2015.3.1104, I’m not sure of other releases.

 Attached is a PDF of the Instance Retention Graph from a popular memory profiler.

We have used RadMenus extensively throughout the product and were able to mitigate the issue with manual recursive cleanup by traversing the visual tree to decouple the RadMenuItems, by clearing all RadMenuItems of subitems and then all RadMenu's of all RadMenuItems. This has allowed the vast majority of the product to be collected with the exception of the RadMenuItems items themselves, which appear to be held onto by a ResourceDictionary.

We haven’t noticed this type of behavior with any other control, either Telerik or ours. Is this supposed to be doing this or are we supposed to do something else to release the memory?

If you need any additional info, please don’t hesitate to ask. Thank you,

 Patrick

 

7 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 13 Jan 2016, 09:21 PM
Trying attachment again...
0
Accepted
Kalin
Telerik team
answered on 14 Jan 2016, 01:40 PM
Hello Patrick,

Thanks for bringing this to our attention.

We managed to reproduce the issue and I logged it in our internal backlog. What I can suggest you for now as workaround would to either to stop the Animations of the Menu or use the following code before clearing the menu:

private void Button_Click(object sender, RoutedEventArgs e)
{
    var grids = xTestContainer.ChildrenOfType<Grid>().Where(x => x.Name == "RootElement");
    foreach (var grid in grids)
    {
        grid.Resources.Clear();
    }
    xTestContainer.Children.Clear();
    //xTestContainer.Child = null;
}

Please test the workaround in the sample project and let me know if it will work for you. I have also updated your Telerik points for your involvement.

Regards,
Kalin
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Patrick
Top achievements
Rank 1
answered on 14 Jan 2016, 05:41 PM

Kalin,
Thank you for the quick response. This seems to work very well, I implemented it with an extension method as such:

1.public static void CleanupRadMenuResources(this RadMenu menu)
2.{
3.    var grids = menu.ChildrenOfType<Grid>().Where(x => x.Name == "RootElement");
4.    foreach (var grid in grids)
5.    {
6.        grid.Resources.Clear();
7.    }
8.}

 

The RadMenuItems themselves are now cleaned up. Also noted disabling animation worked as well. Could you please show your recommendation for disabling animation on just the RadMenu instead of using the global code below?

1.AnimationManager.IsGlobalAnimationEnabled = false;

 

Could you estimate that this issue with RadMenuItem animation would be fixed in the next major release?

Thanks again Kalin.

0
Kalin
Telerik team
answered on 19 Jan 2016, 09:13 AM
Hi Patrick,

You can stop only RadMenu animations as shown below:

<telerik:RadMenu telerik:AnimationManager.IsAnimationEnabled="False">
...

As for the issue - currently I cannot commit any time frame. However I also logged it in our Feedback portal, so you can easily track its status on the following link:

http://feedback.telerik.com/Project/143/Feedback/Details/180571-animationmanager-is-causing-memory-leak-in-radmenuitem-when-the-expand-animation

If you have any other questions, please do not hesitate to contact us.

Regards,
Kalin
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Patrick
Top achievements
Rank 1
answered on 19 Jan 2016, 03:55 PM

Kalin,

Thank you for the update.

-Patrick

0
Patrick
Top achievements
Rank 1
answered on 24 Apr 2018, 08:09 PM

Any update on this?

I just found another memory leak in the RadMenu related to subitem tooltips. I will create a support ticket for that separately.

Thanks,

Patrick

0
Kalin
Telerik team
answered on 26 Apr 2018, 06:02 AM
Hello Patrick,

The AnimationManager issue is not fixed yet - please follow the item in order to get notified once its status changes.

If you have any other questions or concerns, please let us know.

Regards,
Kalin
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Menu
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or