|
|
Re: No more handles problem [message #453105 is a reply to message #453032] |
Wed, 30 March 2005 17:26 |
Cameron Bateman Messages: 39 Registered: July 2009 |
Member |
|
|
After much help from Randy and Pratik, I figured out that this was due to
a resource leak not detected by Sleak. As the Sleak home page says, it
does not detected "widget leaks", since these are rare due to "rule 2".
What I found in our code was something that was equivilent (although less
obvious) to this:
while(true)
{
GC gc = new GC(new Shell());
// do some stuff with gc
gc.dispose();
}
Even once I realized this was what was happening, I almost overlooked to
problem. Which is, of course, that a new Shell's UI resources are being
leaked on every pass. Of course, Sleak doesn't detect this, since it's a
Window handle being leaked not a graphical resource.
What's most interesting is, on W2K this didn't seem to cause any problems,
but on WinXP it eventually results in NoMoreHandles errors on *graphical*
resources (in my case Image and GC construction) even though these are not
being leaked.
I am presently improving Sleak to give a running count of default shells
(those returned by Display.getCurrent().getShells()) as well as a total
count of all Composites and Controls that exist. BTW, is there a simpler
way to do that than simply recurse the tree of children starting from
Display.getCurrent?
I hope to be able to contribute the improvements to Sleak in some form to
Eclipse.
--Cam
Steve Northover wrote:
> Not sure why this is happening. I suggest you take it up with GEF and
> provide a snippet for us to debug. If the problem is really in SWT, the bug
> report will be forwarded to us.
|
|
|
Powered by
FUDForum. Page generated in 0.03431 seconds