Fully featured low overhead profiler for Java EE and Java SE platforms.
Performance monitoring and profiling of Jenkins, TeamCity, Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Finalizer objects and heap monitoring question

Moderators: Vladimir Kondratyev, Anton Katilin

Finalizer objects and heap monitoring question

Postby orfano » Mon Apr 20, 2020 11:45 pm

Hello team,

I have come across with excellent explanations of how java.lang.ref.Finalizer works.
However, I still have a doubt which I hope to be able to clarify in this forum.


Here is the scenario we are facing, we have a Java application running and even though when there is no heavy load submitted against it, there are still some threads running in the background to send information to other systems. And since there is some monitoring in place, sometimes the memory usage goes over a threshold and an alert is raised.
When we take a heap dump and check it we see that java.lang.ref.Finalizer is on top of the Class console (for Yourkit) and the retained Size is quite big.

My question is, for the perspective of HEAP monitoring using VMConsole and other tools, would the Finalizer be taken into consideration? Which would explain why the alert was raised?

TIA! Flavio
orfano
 
Posts: 2
Joined: Mon Apr 20, 2020 11:32 pm

Re: Finalizer objects and heap monitoring question

Postby Anton Katilin » Tue Apr 21, 2020 5:20 pm

Hello Flavio,

Do you mean the objects among "Objects pending finalization"?
https://www.yourkit.com/docs/java/help/reachability.jsp

A JVM implementation (HotSpot for example) may physically add a finalizeable object to the finalization queue immediately upon the object creation, but not when the object actually becomes unreachable as one may expect. The fact that an object is in the queue does not mean anything except for what the object's class has finalize() method redefined.

If you are interested in objects really pending GC, you should consider only those among "Objects pending finalization" as the above mentioned view shows.

Best regards,
Anton
Anton Katilin
 
Posts: 5923
Joined: Wed Aug 11, 2004 8:37 am

Re: Finalizer objects and heap monitoring question

Postby orfano » Tue Apr 21, 2020 9:58 pm

Hello Anton,

Thank you very much for your answer. It is exactly the reachability view that you mentioned that I am interested in and I have doubt.
So if we use the link you shared https://www.yourkit.com/docs/java/help/reachability.jsp we can see that in this example we see that the objects unreachable and not collected account for 681,163 objects and 65% of retained size.
Let's say we had also VisualVM showing the memory of the JVM at that moment as an image example in https://visualvm.github.io/ . If you look at the heap memory tab the blue represents used heap(on the right). Would this no collected objects be part of this used heap memory in the Visual VM? I hope it is clear my doubt.

TIA! Flavio
orfano
 
Posts: 2
Joined: Mon Apr 20, 2020 11:32 pm

Re: Finalizer objects and heap monitoring question

Postby Anton Katilin » Wed Apr 22, 2020 3:08 pm

Hello Flavio,

Yes. All objects still existing in the heap constitute the used heap size.

Best regards,
Anton
Anton Katilin
 
Posts: 5923
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: No registered users and 1 guest

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.