MVVMCross - SqlBits Memory Leak

怎甘沉沦 提交于 2019-12-11 14:32:22

问题


We are developing an Monotouch application with MVVMCross similar to SqliBits sample (the UINavigationCOntroller has a tab controller and inside the tab controller there is anothe navigation controller). It seems that the memory gets allocated but never released.

To reproduce this error launch the SqliBits sample with the profiler select Sessions tab and then select a day go back, select a day go back,... and then look at the memory allocation and you will see that trhe memory gets allocated but never released.

I am allowed to attach an image yet but it is fairly easy to reproduce the error.

Regards, Dan


回答1:


As an issue, this has been discussed on https://github.com/slodge/MvvmCross/issues/19

iOS only frees up Views (via View Controller ViewDidUnload method) when there is a memory shortage - within the Simulator this can be artificially created from the Hardware menu.

Beyond this, there was also a small memory leak which looks like it was caused by a reference to the ViewModel in the Action fields within the RelayCommand. It's not entirely clear to me what caused this, but adding Dispose methods to the RelayCommand which nulls this Action seems to have removed the problem (see https://github.com/slodge/MvvmCross/commit/8fc1af3fc9960445b5358daf8111f6bc9683b907)



来源:https://stackoverflow.com/questions/11735764/mvvmcross-sqlbits-memory-leak

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!