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,
7 Answers, 1 is accepted
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:
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.
Thank you for the quick response. This seems to work very well, I implemented it with an extension method as such:
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?
Could you estimate that this issue with RadMenuItem animation would be fixed in the next major release?
Thanks again Kalin.
You can stop only RadMenu animations as shown below:
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:
If you have any other questions, please do not hesitate to contact us.
Thank you for the update.
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.
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.