1

主题“内存泄漏”这不是一个容易的主题,而且当涉及到内存泄漏时,并不总是可以意识到。

尚未对我的项目进行分析(诊断工具 VS2015),发现存在内存泄漏,特别是 ObservableCollectios。

我的收藏有一些时间,但是,我已经在应用程序使用情况下添加和删除项目,但是,应用程序使用的内存永远不会下降。

注释的代码行:

OnPropertyChanged("MyCollection")

并且内存没有上升太多,所以我怀疑这是问题所在。

谁能帮我一把?

宣言:

private ObservableCollection<MyStructure> myCollection= new ObservableCollection<MyStructure>();
        public ObservableCollection<MyStructure> MyCollection
        {
            get { return this.myCollection; }
            set { this.SetProperty(ref this.myCollection, value); }
        }

// do Add items and Remove, and soon after I make the following command: 

OnPropertyChanged("MyCollection") // To update data in UI. This command is available in INotifyPropertyChanged

谢谢你

4

0 回答 0