如何获取属于某个进程的打开句柄的计数?
您可以使用程序Process Explorer来查看正在运行的应用程序有多少个句柄。有没有办法用Delphi代码来获取这个数字?我有兴趣跟踪应用程序本身的号码;不要像 Process Explorer 那样查找其他应用程序使用的句柄数量。
我的目的是让应用程序跟踪/检测可能的资源泄漏。
You can use the program Process Explorer to see how many handles running applications have. Is there a way with Delphi code to get this number? I am interested in tracking the number for the application itself; not to find the number of handles used by other applications as Process Explorer is doing.
My intention is for the application to track/detect possible resource leaks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
GetProcessHandleCount
函数。这个 API 函数在最新版本的 Delphi 中由 Winapi.Windows 单元导入(因此您可以省略所提供的函数):Use the
GetProcessHandleCount
function. This API function is in recent versions of Delphi imported by the Winapi.Windows unit (so you can omit the presented one):