[英]Determining Pending Finalizer Sources
I'm coming into a project that has a known issue. 我正在参加一个存在已知问题的项目。 The application hangs on a call to
GC.WaitForPendingFinalizers
. 该应用程序挂在对
GC.WaitForPendingFinalizers
的调用上。 The obvious
solution
workaround is to remove the WaitForPendingFinalizers
call but unfortunately this is being done for us in a third-party assembly, so removal is not an option. 显而易见的
解决
方案是删除WaitForPendingFinalizers
调用,但不幸的是,此操作已在第三方程序集中为我们完成,因此无法删除。
Instead, I want to find the root of the issue and figure out who's finalizer is blocking. 相反,我想找到问题的根源,并弄清楚谁的终结者正在阻止。 The codebase, however, is large and since I'm just coming into it, it's also unfamiliar so I don't even have any gut feelings or intuitions of where it might be.
但是,代码库很大,而且由于我刚接触它,所以它也不熟悉,所以我什至对它可能在哪里都没有任何直觉或直觉。 This means I'm going to need to use intrumentation and tools to help find it.
这意味着我将需要使用仪器和工具来找到它。
So my questions are: 所以我的问题是:
This might be one of those cases where Windbg is your friend. 这可能是Windbg是您的朋友的情况之一。 Have a look at Tess's blog.
看看Tess的博客。 Here's an article about debugging a finalizer issue with the !finalizequeue debugger command.
这是有关使用!finalizequeue调试器命令调试终结器问题的文章。 http://blogs.msdn.com/b/tess/archive/2007/10/19/net-finalizer-memory-leak-debugging-with-sos-dll-in-visual-studio.aspx
http://blogs.msdn.com/b/tess/archive/2007/10/19/net-finalizer-memory-leak-debugging-with-sos-dll-in-visual-studio.aspx
(If you've never done anything with windbg and sos.dll before, do some more reading on Tess's blog. She has some articles that make it very approachable). (如果您以前从未使用windbg和sos.dll进行过任何操作,请在Tess的博客上进行更多阅读。她提供了一些文章,使其很容易上手)。
I took a quick look in VS (VS 11) and when I break I can see a Thread called "GC Finalizer Thread" and it's caught doing a Sleep() in my destructor. 我快速浏览了VS(VS 11),当我中断时,我可以看到一个名为“ GC Finalizer Thread”的线程,并且在析构函数中执行Sleep()被捕获。
But your mention of CF may make it an entirely different ballgame. 但是您对CF的提及可能会使它完全不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.