“正在使用"多少个Windows句柄? [英] How many Windows handles in use is "too many"?

查看:199
本文介绍了“正在使用"多少个Windows句柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道此问题的答案可能取决于注册表设置和Windows版本,如果没有足够的内存,则可能取决于RAM的数量.出于这个问题,假定服务器具有足够的RAM(3+ GiB).

I understand that the answer to this question may depend on registry settings and on the version of Windows, and perhaps on the amount of RAM if there is not enough memory. For the sake of this question, assume that the server has plenty of RAM (3+ GiB).

如果一个应用程序(在这种情况下为第三方应用程序)每小时泄漏几百个句柄,那么在其他应用程序遇到麻烦之前,该应用程序可以泄漏多少个句柄?例如,麻烦"是指无法启动线程,无法打开文件等等.

If an application (3rd party application in this case) leaks handles at a few hundred an hour, how many total handles can that application leak before other applications will run into troubles? By "troubles" I mean, for example, fail to start a thread, fail to open a file, and so on.

我已经看到一些服务器(轻负载)在使用数以万计的句柄的进程(通常是数据库进程)上运行得很好,因此,以前的10000句柄限制显然不是这里的问题. (而且那仍然是每个进程的限制,因此不会影响我的应用程序,因为在这一点上就可以了.)

I've seen some servers (lightly loaded) run just fine with a process (usually a database process) using a few tens of thousands of handles, so the old 10000 handle limit is clearly not the issue here. (And that was a per-process limit anyway, so wouldn't affect my application which is well under that point.)

有人可以回答这个问题还是可以向我指出一些资源,这些资源可以解释Windows服务器在允许有效使用(句柄或其他系统资源)之前将允许多少个句柄?

Can someone either answer the question or point me at some resources that explain about how many total handles a Windows server will allow before you effectively run out (of handles or other system resources)?

推荐答案

请参见

See Raymond Chen's post on this topic. The window manager enforces a limit of 10K per process, and has a total limit of 32K across the system. So if it "only" leaks 100 handles per hour, then you have a few days of uptime before it starts misbehaving.

请注意,并非所有句柄都相等.例如,窗口句柄不是数据库句柄,并且可能遵循不同的规则.因此,此限制可能不适用,具体取决于程序泄漏的句柄类型. 也请阅读此博客文章.

Note that not all handles are equal. Window handles are not DB handles, for example, and may follow different rules. So this restriction might not apply, depending on what sort of handles the program is leaking. Also read this blog post.

这篇关于“正在使用"多少个Windows句柄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆