Say that I have an object A that implements INotifyPropertyChanged. I am listening to change events in another object (say, a ViewModel) using a standard event subscription:
myObject.PropertyChanged += SomeMethodInViewModel;
Now if I don't know the lifecycle of the ViewModel, I can't unsubscribe from the event. Hence, I will have a memory leak because object A now holds a strong reference to the ViewModel even after the latter is not in use anymore.
What is the best practice for subscribing to INotifyPropertyChanged property change events?