MattNorman
Well-known member
- Joined
- May 22, 2021
- Messages
- 98
- Programming Experience
- 1-3
I have noticed that my memory usage keeps increasing when switching views.
This is expected at the moment up until a point where each view has been loaded once.
The issue I have is if I switch to my 'Dashboard' view, switch to another view and then back to the dashboard view, it doesn't appear that the previous view is cleared from memory.
I tried setting up a dictionary that holds a reference to all view models and if a view is loaded a second time, it will set that reference to a new instance and assign it as the data context. I'm not sure this is working though as I still see the memory usage climbing.
I know I am probably going about this the complete wrong way so would appreciate any advice.
I essentially have a main window that contains all of the menu along with a content control. The content control is bound to a property that holds an instance of the view that is to be displayed.
How should I go about making sure everything is fully released whenever I change the view that is displayed in the content control?
Regards
Matt
This is expected at the moment up until a point where each view has been loaded once.
The issue I have is if I switch to my 'Dashboard' view, switch to another view and then back to the dashboard view, it doesn't appear that the previous view is cleared from memory.
I tried setting up a dictionary that holds a reference to all view models and if a view is loaded a second time, it will set that reference to a new instance and assign it as the data context. I'm not sure this is working though as I still see the memory usage climbing.
I know I am probably going about this the complete wrong way so would appreciate any advice.
I essentially have a main window that contains all of the menu along with a content control. The content control is bound to a property that holds an instance of the view that is to be displayed.
How should I go about making sure everything is fully released whenever I change the view that is displayed in the content control?
Regards
Matt