Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all instances of a class while debugging in Eclipse

I was wondering if the way Java/JVM works means debugging tools like Eclipse can show me a list of all instances of a given class? I suppose one could write some reflection code but I don't want to break execution at the same place every time... rather I;d like to break execution and bring up a list of all MyClass123 objects in a debug window.

Is this even possible? Is it provided in Eclipse or any plugin?

like image 419
Mr. Boy Avatar asked Oct 18 '12 18:10

Mr. Boy


2 Answers

Yes, it's possible in the standard eclipse debugger. See here. While debugging, right-click on a variable entry in the 'Variables View' and then click on 'All Instances':

enter image description here

This will open a list like this:

enter image description here

like image 109
Tobias Avatar answered Oct 03 '22 14:10

Tobias


You may want to instatall Eclipse Test & Performance Tools Platform plugin in your application and perform MemoryAnalysis. This gives you details around all different objects in memory and their references.

You will not need to put any breakpoint in the code. It will gather the required data on its own.

like image 22
Yogendra Singh Avatar answered Oct 03 '22 14:10

Yogendra Singh