Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
xamTileManager may not be releasing/removing objects from memory
posted

All: All:

We have an WPF application using MVVM, PRISM and the XamTileManager 13.2. Views are injected dynamically into the xamTileManager using prism. Basically, each tile represents one view. The structure is as follows:

SessionTemplateView (WPF Tab Control)

  • PTMTileTemplateView: View injected into Session Template Region

      • MasterRegion (WPF ItemsControl)

        • TileManagerTemplateView - View injected into Master region

          • TileManagerRegion with xamTileManager

            • PTMPayTemplateView - View Injected into TileManager Region

              • PaymentsRegion(WPF ItemsControl)

                • PaymentsView injected into PaymentRegion

                • PaymentAmountsView injected into PaymentsRegion

                •  

            • PTMPenTemplateView -  View Injected into TileManager Region

              • PenaltiesRegion(WPF ItemsControl)

                • PenaltiesView injected into PenaltiesRegion

                • PenaltyAmountsView injected into PenaltiesRegion

      • RLRegion (WPF Items Control)

        • Lookup View - View injected into RLRegion

Every view has a corresponding view model. We have a concept of a session. Each session contains the TileManagerTemplateView. When we close the session we remove the region and publish shutdown events to all the views. All the views and view models have Finalize events that dispose the VM and view. The View and VM in the RL Region, which are not injected into the TileManagerRegion, do get unloaded from memory when the session is closed. Also, the Views from the Master Region get unloaded as well. The issue seems to be the VMs in the Master Region which contains the TileManager. Not only do they not get unloaded, a new instance of the view model gets created every time the tile gets expanded. The VMs do not have any data in the collections, lists etc., but they do remain in memory. We are not sure how to remove these View Models or how to prevent them from being created in the first place.

Any help or recommendations will be highly appreciated.

Regards,

Adolfo

  • 225
    Offline posted

    Question - did you write a Prism RegionAdapter for the xamTileManager? If so there might be some extra clean-up you need to do in the region's view CollectionChanged event for the 'remove' action. I'd be happy to take a look at you region adapter to help diagnose this. If you did not (which I'm not even sure is possible to make work without) you would likely need one.

    Feel free to email on damon.carr@pimco.com to discuss in additional detail.

    Thanks,

    Damon

  • 138253
    Offline posted

    Hello Adolfo,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

  • 138253
    Offline posted

    Hello Adolfo,

     

    Thank you for your post. I have been looking into it, but since this is not a known issue and I cannot be completely sure how your data is organized and how you implement  PRISM, I am not able to conclude what can cause such behavior, so could you please send me an isolated sample project, where this is reproduced and steps to follow, so I can test it for memory leaks?

     

    Looking forward for your reply.