We have an issue in our product with ViewModels hanging around, and using dotMemory I continually see that it appears that tool tips in the ribbon are holding onto things.
I have a sample project where I've managed to repeat the issue. The project has a simple ribbon with a few buttons. The RunRiskAnalysis button is a mock up of one of the buttons in our actual projects ribbon (with bindings and resources taken out).
Steps I take to repeat;
It doesn't happen 100% of the time but happens very frequently..What I see is that when I hover over the RunRiskAnalysis button for the first time I see a jump in unmanaged memory, but I don't think this is related. After I hit the Change DataContext button a few times I see the managed memory go up and not come back down.
Comparing the first and last snapshot I can see there are two instances of my VIewModel when there should only be one.
When I investigate the surviving object I can see that it is being retained by the tool tip. Here are a couple retention paths from a couple different times repeating the issue.
Our product is using 13.1 but I've repeated in our product and in the sample using the latest (23.1)I tried attaching the sample project but it was too big to attach. Let me know where I can send it.
Hello James,
Please delete the bin folder from your project to reduce the project size and try to attach it here again. Since V13.1 is no longer supported i would run/test the sample against latest supported version and if find the memory leak then i would log it to get it fix in the latest supported version . and in order to apply fix patch you would have to upgrade your projects to latest.
Thank you
Infragistics WPF Ribbon Memory Leak.zip
You'll need to put the following in the Referenced Assemblies folder:
InfragisticsWPF4.Editors.23.1.dll
InfragisticsWPF4.Ribbon.23.1.dll
InfragisticsWPF4.23.1.dll
5710.Infragistics WPF Ribbon Memory Leak.zip
Here is a version that gets rid of that control in favor of using XamRibbonScreenTip and still reproduces.I can get it to have two versions of the ViewModel
And one of them is being held by the XamlRibbonScreenTip
I am able to run your sample and can memory profile it .Since i never use dotmemory app i am not familiar with its UI , i used ANTS profile and its easy and can tell you the object instance been used with each memory snapshot and what is been increase/decrease with each snapshot.
So i followed the instruction and infect put a GC.collect to a button click and took multiple memory snapshots and find toolLocation object dint reduce and been increased by +75. between 1st and last snapshot. With your app can you tell me which object did you find is been leaking ?
Regarding seen 2 object of view model on button click, my guess is you click the button so fast and immediately took snapshots and garbage collect dint get enough time to clean it , may be take couple sec before take a snapshot or place a GC.collect on button click and test again.
As of for my finding i am going to log this behavior for the developer to have a look and provide more information .
Going to create a private case C-00232582 to link the issue. You can access private case from your infragistics account's support section.
Let me know if you have any question.
Yes you are right ,on Friday the site was down so we were not able to communicate.
I discussed the matter with the developer and find there is no memory leak ,the 75 instances of ToolLocation is just boxed versions of that enum when its set as a property on a dependency property (like it is on tools and various other elements).
We looked into the screenshots again and find there is some dependency property holding the tooltip element. That is not specific to us but is a wpf property holding that tooltip element. I did some research and find same behavior is been discussed here:
https://stackoverflow.com/questions/32764764/tooltip-memory-leak-in-wpf-while-binding-a-view-to-viewmodel
https://stackoverflow.com/questions/40433139/wpf-tooltip-memory-leak
In your example if you the ToolTip element instead of RibbonToolTip , you would find the same behavior.
You can try it out and let me know if you need further assistance.
It looks like you are correct. I made a version of the sample project using the WPF ribbon control and still see that tool tip is holding onto things.
Thanks for your help. You can close the case.
Thank you for the update.