Paths of Objects without GC roots

Questions about YourKit Java Profiler
Locked
ron.amir
Posts: 7
Joined: Mon Apr 24, 2023 9:29 am

Paths of Objects without GC roots

Post by ron.amir »

Hello, I can see that a certain object is created excessively during a request, however when I capture a memory snapshot at the end of the request and before GC, I see that those object don't have a gc root, i.e. they will be collected by the next gc. Is there a way for me to understand the path to this object even though it doesn't have a root at the end of the request? some way to understand where this object is being created?

Thanks.
Vladimir Kondratyev
Posts: 1660
Joined: Tue Aug 10, 2004 7:52 pm

Re: Paths of Objects without GC roots

Post by Vladimir Kondratyev »

1) Start object allocation recording, make requests and capture memory snapshot
https://www.yourkit.com/docs/java-profi ... ording.jsp

2) Open snapshot and select "reachability" view
https://www.yourkit.com/docs/java-profi ... ity.jsp#ui

3) Select "Objects pending finalization" row and press F4

4) Select "Allocation call tree - All threads merged"
https://www.yourkit.com/docs/java-profi ... merged.jsp

You will see where the objects pending finalization have been allocated.

Best regards,
Vladimir Kondratyev
YourKit GmbH
http://www.yourkit.com
"Don't get lost in data, get information!"
Locked