简体   繁体   English

SWT - 如何调试“不再处理”

[英]SWT - How to debug “No more handles”

from time to time I am haunted by the "org.eclipse.swt.SWTError: No more handles". 我不时被“org.eclipse.swt.SWTError:不再处理”所困扰。 I already know tools like GDIView, to watch the number of handles allocated, but now I wonder if there is a better way to do this. 我已经知道像GDIView这样的工具来观察分配的句柄数量,但现在我想知道是否有更好的方法来做到这一点。

Is there a tool available? 有工具可用吗? Maybe one that logs all stacktraces when handles are created? 也许在创建句柄时记录所有堆栈跟踪? And which shows the new handles between two invocation points? 并显示两个调用点之间的新句柄?

Regards, Daniel 问候,丹尼尔

PS: Added the windows tag because dev occures mostly on windows and a windows only tool would be good enough. PS:添加了windows标签,因为dev主要出现在windows上,而且只有windows的工具才足够好。

I found out about Sleak , a great tool to debug SWT resources! 我发现了Sleak ,一个调试SWT资源的好工具! Highly recommended for everyone with the same problems. 强烈推荐给遇到同样问题的每个人。 Even shows the images for image resources! 甚至显示图像资源的图像!

For me the issue was simply that new Shell() has been called too often. 对我来说,问题很简单,就是经常调用新的Shell()。 Storing the shell as static member and reusing it helped. 将shell存储为静态成员并重用它有帮助。 Therefore, before applying a tool like Sleak, others might want to do a full text search for "new Shell" and check that they don't have the same simple cause. 因此,在应用像Sleak之类的工具之前,其他人可能想要对“新Shell”进行全文搜索并检查它们是否具有相同的简单原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM