WPF框架的内存泄漏BUG

    用户在使用GIX4某模块的过程中,内存只见加不见减。我们怀疑出现了内存泄漏,所以我花了相当一段时间来进行此问题的排查。

    我使用Red Gate公司的产品ANTS Memory Profiler 5进行应用程序的内存进行监视。并在过程中修改程序中出现的一些问题。但是最后留下一个不知道原因的引用,如图1:

image

图1 泄漏对象引用图

    由图中可以看出,Application.Resources永久地引用了临时控件SelectionDataGrid。原因出在DeferredAppResourceReference类的Inflated事件被ResourceReferenceExpression对象引用。经查找相关资料,确定为WPF框架的BUG。该BUG会使内存不断地泄漏。

    官方原文:

When a DeferredResourceReference reference is used by a ResourceReferenceExpression class, the internal Inflated event causes a strong reference to be held to the expression. This keeps the whole visual tree from being collected by the Garbage Collector after the references are removed from the tree if the DeferredResourceReference reference is never inflated.

    另外,该补丁并不提供下载……汗!

 

    BUG详见:FIX: You may lose system resources during the life of some Windows Presentation Foundation applications

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值