c# – Silverlight:如何从内存中卸载(处置)图像?

我有一个图像控件,显示一个大的jpg文件,占用大约50mb的内存.
如果不再需要此控件,该如何处理?我尝试将其从父容器删除,将其设置为null并将其Source属性转换为null,但内存使用率仍保持不变…
任何建议将受到高度赞赏!

解决方法

我终于找到了问题的答案.
问题出在Silverlight中的内存泄漏错误中.
在这里找到了解决这个问题的方法
http://blogs.msdn.com/silverlight_sdk/pages/silverlight-bugs-and-workarounds.aspx

Memory Leak when you Dynamically add
and remove Images

Workaround: 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. *

谢谢大家的建议!

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...