我有一个图像控件,显示一个大的jpg文件,占用大约50mb的内存.
如果不再需要此控件,该如何处理?我尝试将其从父容器中删除,将其设置为null并将其Source属性转换为null,但内存使用率仍保持不变…
任何建议将受到高度赞赏!
如果不再需要此控件,该如何处理?我尝试将其从父容器中删除,将其设置为null并将其Source属性转换为null,但内存使用率仍保持不变…
任何建议将受到高度赞赏!
解决方法
我终于找到了问题的答案.
问题出在Silverlight中的内存泄漏错误中.
我在这里找到了解决这个问题的方法:
http://blogs.msdn.com/silverlight_sdk/pages/silverlight-bugs-and-workarounds.aspx
问题出在Silverlight中的内存泄漏错误中.
我在这里找到了解决这个问题的方法:
http://blogs.msdn.com/silverlight_sdk/pages/silverlight-bugs-and-workarounds.aspx
Memory Leak when you Dynamically add
and remove ImagesWorkaround: When dynamically adding or
removing BitmapImages from an
application (a.k.a. adding/removing
from the tree),you should set
Image.source = null before removing
the Image element from the tree. This
will make the BitmapImage eligible for
garbage collection. Bug Status: Active
bug. *
谢谢大家的建议!
原文地址:https://www.jb51.cc/csharp/243805.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。