Inspection: Classes without instances

Questions about YourKit Java Profiler
Locked
marklassau
Posts: 4
Joined: Tue Mar 24, 2009 12:56 am

Inspection: Classes without instances

Post by marklassau »

The "Classes without instances" inspection existed in YourKit v7.x, but appears to be removed from v8.x.
Any comments?
Vladimir Kondratyev
Posts: 1619
Joined: Tue Aug 10, 2004 7:52 pm

Re: Inspection: Classes without instances

Post by Vladimir Kondratyev »

It was replaced with more powerful "Class Loaders" tool http://www.yourkit.com/docs/80/help/class_loaders.jsp
marklassau
Posts: 4
Joined: Tue Mar 24, 2009 12:56 am

Re: Inspection: Classes without instances

Post by marklassau »

According to the (very sparse) documentation at the page you linked:
For each loader, the number of loaded classes is shown, as well as the number of classes without instances
However, I can only see a column called "Classes".
I assume that this is the number of loaded classes for the given Class Loader, but I cannot see where the classes without instances are found.
Vladimir Kondratyev
Posts: 1619
Joined: Tue Aug 10, 2004 7:52 pm

Re: Inspection: Classes without instances

Post by Vladimir Kondratyev »

"Classes w/o Instances" column is missing on screenshot, but does exist.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Inspection: Classes without instances

Post by Anton Katilin »

Please read more about using the Class Loaders view:
http://www.yourkit.com/docs/kb/class_loaders.jsp
shubhamgu
Posts: 2
Joined: Wed May 11, 2022 10:57 am

Re: Inspection: Classes without instances

Post by shubhamgu »

Hi!

I am able to see class without instances column in class loader view for class loader 'A' . It has a non-zero value. Now I go to the class list for classloader selected. But all the classes listed there have at-least 1 instance.

How can I see the names of classes without instances loaded by 'A'?

Environment
The heapdump was generated automatically by java upon OOM. Yourkit version is 2020.9-b411
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Inspection: Classes without instances

Post by Anton Katilin »

Hi,

Currently there is no way to directly get a list of classes without instances. The dependent view Classes shows instances by class and all classes themselves (java.lang.Class) loaded by the loader.

We can consider adding such functionality. Just curious, why do you need a full list of classes w/o instances? How would you use it? The list is supposed to contain abstract classes, interfaces, utility classes with static methods only, classes referenced from other classes but not yet instantiated.
shubhamgu
Posts: 2
Joined: Wed May 11, 2022 10:57 am

Re: Inspection: Classes without instances

Post by shubhamgu »

I was diagnosing OOM in MetaSpace, and was trying to follow https://www.yourkit.com/docs/kb/class_loaders.jsp
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Inspection: Classes without instances

Post by Anton Katilin »

In this case you should be interested rather in classes which still have instances, because the object causing the class loader leak may be among them. They can be seen in the dependent view "Classes".

The views "Paths from GC Roots" and "Merged Paths" explicitly show how the loader is retained in memory.
Locked