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.

Cannot understand reachability

Moderators: Vladimir Kondratyev, Anton Katilin

Cannot understand reachability

Postby jun » Tue Feb 11, 2020 7:31 pm

Hi,
To understand more, I am reading https://www.yourkit.com/docs/java/help/reachability.jsp, but cannot understand yet.
For example,
Strong reachable: objects reachable from GC roots via at least one strong reference, or being GC roots themselves. Such objects will not be garbage collected until all strong references to them are nulled and/or they remain GC roots. Thus, memory leaks should be searched among them.

Why memory leaks should be searched among strong reachable objects? It could be reachable from GC roots because GC has information for those, so they are not garbage collected because they are used also. So, I reckoned If they are nulled, then GC could garbage collected.
What's wrong in my thought?
Thanks.
jun
 
Posts: 11
Joined: Fri Feb 07, 2020 7:02 am

Re: Cannot understand reachability

Postby Anton Katilin » Wed Feb 12, 2020 8:03 am

Hi,

I'm afraid I don't understand your question.

What do you find unclear in particular?

> Why memory leaks should be searched among strong reachable objects?

Memory leaks may exist among strong reachable objects only, because objects of all other reachability scopes will eventually be collected, unless a strong reference to them is created before they become fully unreachable.

> It could be reachable from GC roots because GC has information for those, so they are not garbage collected because they are used also.

Exactly. The objects reachable from GC roots _are_ strongly reachable. The definition you cited tells exactly that. Where do you see a controversy?

Best regards,
Anton
Anton Katilin
 
Posts: 5924
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.