views:

1277

answers:

3

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.

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.)

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)?

+2  A: 

According to this, 10000.

Otávio Décio
+4  A: 

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.

JSBangs
+2  A: 

The desktop heap, which is a pool of memory where the real "stuff" the handle represents lives. It's sometimes not so much how many handles you have allocated but how much memory each object under that handle is using. You can debug the heap this way. It is a pain to install.

(this was recycled from another one of my answers)

Aardvark