简体   繁体   English

Windows Phone,垃圾收集器即使只有弱引用也无法清除视图

[英]Windows Phone, garbage collector don't clean view even with only weak references

I have a WP7 app that has a memory leak caused by a view, after spending a entire day cleaning it up I finally ended up with only weak references to the view instance. 我有一个WP7应用程序,该应用程序有一个由视图引起的内存泄漏,在一整天的清理后,我最终只获得了对视图实例的弱引用。 The problem is that the garbage collector still doesn't clean the view (I added some code on the destructor to check it out), causing the app inevitably to crash (with out of memory exception), after some aggressive testing. 问题在于,垃圾收集器仍然无法清理视图(我在析构函数上添加了一些代码以将其检出),在进行一些积极的测试之后,不可避免地导致应用崩溃(内存不足异常)。

The screenshot of the GC Roots: http://1drv.ms/1g488IO GC根目录的屏幕快照: http : //1drv.ms/1g488IO

Any ideas what is going on? 有什么想法吗?

The issue was that even if the image shows that the root is weak, it actually doesn't mean it is. 问题是,即使图像显示出根较弱,但实际上并不意味着根较弱。 To solve this issue I just removed all the gc roots, and by doing that the view was destructed. 为了解决这个问题,我只是删除了所有gc根,然后这样做就破坏了视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM