SWT No More Handles
Asked Answered
M

8

27

Windows XP has the limit 10000 user handles for each process and total 32000 for each desktop session. However, when I run 4 or 5 SWT process, each consuming no more than 2000 user handles, the SWT No More handles exception will always be threw.

Does anyone know why?

Manzanares answered 7/1, 2010 at 6:10 Comment(0)
E
46

If I understand you correctly, you are probably getting the following exception:

org.eclipse.swt.SWTError: No more handles

You may be creating resources (such as Font, Image or GC objects) that you aren't correctly disposing. You might want to take a moment to read through the SWT guide on Managing Operating System Resources.

To determine if this is indeed the case, I can recommend this useful article: Diagnosing Handle Leaks in SWT/RCP Windows Applications, which explains what resources are and suggests using Process Explorer or DPus to locate leaks.

A colleague also highly recommends Sleak, a SWT-focused application that can actually inform you which resources are remaining in residual memory.

For a very technical understanding of what handles SWT is making, this Sybase article describes that there are three kinds: User Object, GDI Object or Kernel Object handles, each of which has its own maximum.

Epitome answered 7/1, 2010 at 13:58 Comment(0)
D
7

You have some sort of resource leak in your program most likely. Use the following utility (http://www.eclipse.org/articles/swt-design-2/sleak.htm) as an easy way to find swt resource leaks. I used it to clean up a whole slew of problems in an rcp app I was working on

Doyon answered 8/1, 2010 at 17:42 Comment(0)
I
2

The limit isn't 10000 handles. Applications can use far more than 10000 handles (if RAM allows). The limit is on GDI and User resources (graphical elements).

What kind of resources are the SWT applications using (you can see this with taskmgr)? That would help to understand what is leaking.

Intranuclear answered 7/1, 2010 at 7:24 Comment(0)
P
1

For the record, if this were my question I would have accepted @Paul's answer. However, there is one sneaky issue that I'd like to add here to potentially help someone else if they come across this problem...

Check your usage of fonts.

In my case, my handles were not all that high, but instead I was new'ing up font instances and handing them to the StyledText style. I had to instead declare the fonts I wanted to use once, class level. This fixed it for me.

Ponytail answered 28/12, 2010 at 19:20 Comment(0)
L
1

I've seen this error too in eclipse 3.6 SR1, it turned out to be caused by hundreds of editor tabs being left open. Closing the tabs fixed the error.

Lodicule answered 24/4, 2011 at 9:49 Comment(0)
S
0

Try following steps:

  • go to eclipse home directory (where you installed eclipse), then go to plugins folder
  • remove all the recently install plugins starting with com.google.*
  • try restarting your eclipse again, it may start working again (worked for me.)
  • try to install old plugins from google or just once that you need. (I am going to try this.)
Smoking answered 14/6, 2014 at 12:14 Comment(0)
N
0

On my system Windows7 x64 I can reproduce it when TeamViewer 8 is running (www.teamviewer.com). When I stop TeamViewer, the bug disappears.

you may look into : https://bugs.eclipse.org/bugs/show_bug.cgi?id=402983

Hope that helps.

Nary answered 9/12, 2014 at 5:42 Comment(0)
L
0

I've also met this problem, but now i've solved it.

In my case, i'm running Win7 with SP1 and Spring Tool Suite 3.7.2 (Eclipse Mars 4.5.1) through Citrix XenApp. This error happens when i switch between Package Explorer and Java Editor.

My solution:
run services.msc in Win7, find "Tablet PC Input Service", stop it.

Hope this may help others.

Libb answered 7/12, 2016 at 7:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.