Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: Debugging & inspection of variables causes com.sun.jdi.ObjectCollectedException

Tags:

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. After searching in different sources I figured out that most likely the object was Garbage Collected. Clicking here and there I could retrieve my object by nevertheless in the Variables view I cannot inspect the variable.

-vmargs -Dosgi.requiredJavaVersion=1.8 [email protected]/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. Any hints how to avoid that kind of GC problems? Is this some kind of setting in the IDE?

like image 442
LeO Avatar asked Feb 27 '18 08:02

LeO


People also ask

How do I Debug a breakpoint in Eclipse?

To put breakpoints in your code, double click in the left margin on the line you want execution to stop on. You may alternatively put your cursor in this line and then press Shift + Ctrl + B . To control execution use the Step Into, Step Over and Step Return buttons. They have the shortcuts F5 , F6 and F7 respectively.

What is F6 and F8 in Debug on Eclipse?

F6 - execute a perform .. without going inside form.. endform... F7 - come out of a perform .. F8 - execute the report entirely or upto the next break point ..


2 Answers

Right click the variable, then click "Show Logical Structure", uncheck any collection.

like image 129
Justin Avatar answered Oct 26 '22 04:10

Justin


While execution of your code is stopped at a breakpoint:

  1. Right-click the variable in the Variables pane
  2. Clicking on the collections (such as the Array in the image below) will uncheck them
  3. Now you can inspect the variable

enter image description here

like image 40
Josh Withee Avatar answered Oct 26 '22 04:10

Josh Withee