Friday, June 20, 2008

Fighting with "No more handles"

I have not found more irritating thing ever - actually there is the only thing (for me) that causes RCP to stop working.

Unfortunately handle limits are not written down anywhere - because they differ a lot depending on component and operating system. It is very often caused by 10 000 handles limit per process in Windows XP.

How to increase the number of available handles?

Someone clever told: "if you ask, you are wrong".

And this is completely right - do you really need 10000 thousand of controls on your form? Do you really need to be able to serve tens of views and editors at once?

You do not have so many controls? Install sleak and look for handle leaks.

If you went through two previous points, and you are completely sure, that you need every single control you are using, your interface is well designed and you do not have memory leaks... than please open your task manager, go to the processes view, select view -> select columns and check User Objects. You should see something like that:

Now please verify that there is a strong correlation between USER counts and the number of opened editors/views etc, and be sure that No More Handles occurs when User Handles approaches 10 000.

If you have confirmed, that you have really met a Windows limitation, please rethink once more your design.

And then go to and follow their instructions. And be aware of their "limited" responsibility for that hotfix ;-).



Przemoc said...

Standard task manager is not a reasonable tool, because it's incomplete and uses incorrect terminology in naming different things (e.g. memory usage).

Sysinternals (now it's part of Microsoft TechNet) Process Explorer is far superior utility. Use it once and you'll forget how task manager looks like - there is an option that replaces task manager and every user checks it. No exceptions ;)

Other Sysinternals Tools are also very useful, so don't hesitate to check them all in spare time.

Nikos said...

"No more handles"

sounds familiar :)

I got this sweet Windows message after starting using a Nebula widget : CDatetime.
I found that one instance of this widget used 500 handles by itself !!!
Put 20 of this in an editor and...

By the way I didn't checked if this "feature" of CDateTime has been corrected.


PS : Process Explorer is great :)

Mik Kersten said...

Also see:

211124: too easy to hit global GDI handle max on Windows Vista with Sun VM

PhG said...

Well, that is strange because I often get the no-more-handle from SWT far before my GDI handle count reaches 10000 (per process).
It seems that things start going wrong when the total count (for all processes) reaches some limit (10k?) looks about 6000-7000. Today, I could not start eclipse at all, IExplorer was hogging 1800+1300 handles (in 2 instances), seamonkey about 300 and Lotus Notes v8 about 1200+400. I closed down iexplorer and things went back all right....

PhG said...

Is there a command-line tool that can dump the GDI objects per process? I don't want to manually add what I get in task man...

PhG said...

BTW, its is usyally GDI objects that seem to caus etroubel, I never get as high with User handles...
thanks for any comment

Anonymous said...

Do you know what is the equivalent into linux and/or mac OS of GDI handles? Is there also a limit? Where can we find it?


Aurelien Pupier