0

当我在 WinDbg 中使用!htrace -diff调试句柄泄漏时,我得到了很多不显示调用堆栈的句柄(可能是正在泄漏的句柄):

这可能是什么原因,我有哪些选项可以进一步调试?

Handle = 0x000273e4 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273e0 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273dc - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273d8 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273d4 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273d0 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273cc - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273c8 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273c4 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273c0 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273bc - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273b8 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273b4 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273b0 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273ac - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273a8 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------
Handle = 0x000273a4 - OPEN
Thread ID = 0x00001190, Process ID = 0x0000114c

--------------------------------------

更新:句柄泄漏似乎取决于图形驱动程序或图形卡。当我使用任何形式的 WPF 时,它就会开始泄漏,它只会在某些具有特定显卡/驱动程序的 Windows XP 系统上泄漏。

4

1 回答 1

1

调用是由 ZwOpenProcess 例程 (http://msdn.microsoft.com/en-us/library/windows/hardware/ff567022(v=vs.85).aspx) 在内核模式下执行的,而不是 ZwClose 调用。然后手柄泄漏。您看不到调用堆栈,因为它们仅在从用户模式(OpenProcess / CloseHandle)执行调用时可用。

在 XP SP3 上,似乎很难找到罪魁祸首。解决方案是使用操作系统中内置的“对象引用跟踪”功能,但这条路径存在问题(请参阅http://www.osronline.com/showthread.cfm?link=198302以获取更多参考)。由于您发现此问题仅在存在特定视频卡时出现,您可以尝试联系供应商或检查更新版本的驱动程序。

于 2011-10-21T21:26:15.237 回答