Memory leak in WPF app due to DelegateCommand.
- by Abdullah BaMusa
I just finished desktop apps written in WPF and c# using MVVM pattern. In this app I used Delegate Command implementation to wrap the ICommands properties exposed in my ModelView. The problem is these DelegateCommands prevent my ModelView and View from being garbage collected after closing the view. So it stays larking until I terminate the whole application. I profile the application I find it’s all about delegatecommand that keeping the modelview in memory.
How could I avoid this situation and is this in nature of mvvm pattern, or it’s about my implantation of the pattern?. Thanks