最近在找一些关于Silverlight 程序内存泄露的问题。找到一篇2008年10月的blog ,里面列举了一些已知的bug和修补办法,不确定这些bug在新版本中是否被修复了。其中果然有内存泄露相关的bug....
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. *
ImageSource and ImageBrush events can cause a memory leak
搜索Microsoft Connect 网站又找到一个,Silverlight 4中的关于内存的bug:
Silverlight 4: High memory usage results in crash when navigating away from the page