[英]Eclipse: Debugging & inspection of variables causes com.sun.jdi.ObjectCollectedException
I debug my program and add here and there a breakpoint.我调试我的程序并在这里和那里添加一个断点。 After a stop I want to inspect some of the variables and get sometimes a
com.sun.jdi.ObjectCollectedException
.停下来后,我想检查一些变量,有时会得到一个
com.sun.jdi.ObjectCollectedException
。 After searching in different sources I figured out that most likely the object was G arbage C ollected.在搜索不同的来源后,我发现该对象很可能是G arbage Collected。 Clicking here and there I could retrieve my object by nevertheless in the
Variables
view I cannot inspect the variable.单击此处和那里我可以检索我的对象,但是在“
Variables
”视图中我无法检查变量。
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms512m
-Xmx4096m
--add-modules=ALL-SYSTEM
I'm running under Linux/OpenSuSe with OpenJDK 1.8.0_151.我在使用 OpenJDK 1.8.0_151 的 Linux/OpenSuSe 下运行。 Any hints how to avoid that kind of GC problems?
有什么提示可以避免这种 GC 问题吗? Is this some kind of setting in the IDE?
这是IDE中的某种设置吗?
Right click the variable, then click "Show Logical Structure", uncheck any collection.右键单击变量,然后单击“显示逻辑结构”,取消选中任何集合。
This bug has been fixed in Eclipse 4.18此错误已在 Eclipse 4.18 中修复
https://www.eclipse.org/eclipse/news/4.18/jdt.php https://www.eclipse.org/eclipse/news/4.18/jdt.php
Stabilized logical structures in Variables view with active GC
具有活动 GC 的变量视图中的稳定逻辑结构
The Debug view no longer breaks when logical structures are shown while the application's garbage collector is active (com.sun.jdi.ObjectCollectedException occurred while retrieving value).
当应用程序的垃圾收集器处于活动状态时显示逻辑结构时,Debug 视图不再中断(com.sun.jdi.ObjectCollectedException 在检索值时发生)。
Instead of turning off logical structure, you can add a logical structure formatter, as detailed in this answer: Eclipse debug mode view instance variable values .您可以添加一个逻辑结构格式化程序,而不是关闭逻辑结构,如以下答案中所述: Eclipse 调试模式视图实例变量值。 This prevents the exception and lets you see the variable in a useful way.
这可以防止异常并让您以有用的方式查看变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.