Silverlight WinDg 内存释放问题

发布于 2024-10-12 06:35:24 字数 1960 浏览 5 评论 0原文

我曾多次成功地使用 WinDbg 来跟踪和修复内存泄漏(或者更准确地说,CLR 无法对已释放的对象进行垃圾收集),但我一直坚持使用一种特定的控件。该控件显示在子窗口中,当窗口关闭时,对该控件的引用仍然存在并且无法被垃圾收集。我已经解决了我认为可能导致泄漏的大部分问题,但是受影响对象的 !gcroot 并不清楚(至少对我来说)到底是什么仍然保留在该对象上。无论子窗口中呈现的内容如何,​​输出始终相同:

DOMAIN(03FB7238):HANDLE(Pinned):79b12f8:Root: 06704260(System.Object[])-> 05719f00(System.Collections.Generic.Dictionary2[[System.IntPtr, mscorlib],[System.Object, mscorlib]])-> 067c1310(System.Collections.Generic.Dictionary2+Entry[[System.IntPtr, mscorlib],[System.Object, mscorlib]][])-> 064d42b0(System.Windows.Controls.Grid)-> 064d4314(System.Collections.Generic.Dictionary2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 064d4360(System.Collections.Generic.Dictionary2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 064d3860(System.Windows.Controls.Border)-> 064d4218(System.Collections.Generic.Dictionary2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 064d4264(System.Collections.Generic.Dictionary2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 064d3bfc(System.Windows.Controls.ContentPresenter)-> 064d3d64(System.Collections.Generic.Dictionary2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])-> 064d3db0(System.Collections.Generic.Dictionary2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])-> 064d3dec(System.Collections.Generic.Dictionary2[[System.UInt32, mscorlib],[System.Windows.DependencyObject, System.Windows]])-> 064d3e38(System.Collections.Generic.Dictionary2+Entry[[System.UInt32, mscorlib],[System.Windows.DependencyObject, System.Windows]][])-> 06490b04(Insurer.Analytics.SharedResources.Controls.HistoricalKPIViewerControl)

如果有人对可能出现的问题有任何想法,或者如果您需要更多信息,请告诉我。

亲切的问候, 克里斯

I have used WinDbg succesfully on a number of occasions to track down and fix memory leaks (or more accurately the CLRs inability to garbage collect a released object), but am stuck with one particular control. The control is displayed within a child window and when the window is closed a reference to the control remains and cannot be garbage collected. I have resolved what I believe to be the majority of the issues that could have caused the leak, but the !gcroot of the affected object is not clear (to me at least) as to what is still holding on to this object. The ouput is always the same regardless of the content being presented in the child window:

DOMAIN(03FB7238):HANDLE(Pinned):79b12f8:Root: 06704260(System.Object[])->
05719f00(System.Collections.Generic.Dictionary2[[System.IntPtr, mscorlib],[System.Object, mscorlib]])->
067c1310(System.Collections.Generic.Dictionary
2+Entry[[System.IntPtr, mscorlib],[System.Object, mscorlib]][])->
064d42b0(System.Windows.Controls.Grid)->
064d4314(System.Collections.Generic.Dictionary2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
064d4360(System.Collections.Generic.Dictionary
2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
064d3860(System.Windows.Controls.Border)->
064d4218(System.Collections.Generic.Dictionary2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
064d4264(System.Collections.Generic.Dictionary
2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
064d3bfc(System.Windows.Controls.ContentPresenter)->
064d3d64(System.Collections.Generic.Dictionary2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
064d3db0(System.Collections.Generic.Dictionary
2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
064d3dec(System.Collections.Generic.Dictionary2[[System.UInt32, mscorlib],[System.Windows.DependencyObject, System.Windows]])->
064d3e38(System.Collections.Generic.Dictionary
2+Entry[[System.UInt32, mscorlib],[System.Windows.DependencyObject, System.Windows]][])->
06490b04(Insurer.Analytics.SharedResources.Controls.HistoricalKPIViewerControl)

If anyone has any ideas about what could potentially be the problem, or if you require more information, please let me know.

Kind Regards,
Chris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流星番茄 2024-10-19 06:35:24

静态数据通过固定的 Object[] 存储,因此它可能是对 IntPtr 字典的静态引用,Object 是它的根。您可以尝试查看字典,看看其他条目是否提供了任何有用的线索。

然而,考虑到 IntPtr,我希望这是 Silverlight 运行时在内部使用的东西。

我会遍历根目录并查找应用程序使用的任何类型并验证它们是否都正常。

Statics are stored via a pinned Object[], so it could be a static reference to a dictionary of IntPtr, Object rooting it. You could try to look into the dictionary to see if the other entries provides any useful clues.

However, given the IntPtr I would expect this to be something the Silverlight runtime uses internally.

I would go through the roots and look for any types used by the application and verify that they are all okay.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文