我一直在研究如何避免由INotifyCollectionChanged
视图模型中对事件的强引用引起的内存泄漏。我正在使用 aListCollectionView
来查看是否可以解决我的问题。我认为以下是泄漏内存,我做错了吗?
var stuff = new ObservableCollection<string>();
while (true)
{
var result = new ListCollectionView(stuff);
// Just to keep make sure that the memory I'm seeing
// isn't waiting to be GC'd
GC.Collect();
}