In this post, we will see how to resolve How is it possible for an object not being referenced by other objects in Java heap dump?
Question:I opened a heap dump in VisualVM and some objects don’t have incoming references to them. They are unreachable.
I wonder: is it OK to see them? Are they subject to a next GC and just slipped into the heap dump?
The full GC usually has 10-20 minutes intervals. Soft/Weak references are not the case.
Best Answer:jmap has an option to control that controls should a dump contains unreachable objects:
Dumps the Java heap in hprof binary format to filename. The live suboption is optional. If specified, only the live objects in the heap are dumped. To browse the heap dump, you can use jhat (Java Heap Analysis Tool) to read the generated file.
This indirectly tells that a heap dump could contain unreachable objects.
jcmd syntax is:
-alladds dead objects, by default only live. Unlike for
jhatwhere all are by default.
Seems TLAB (Thread Local Allocation Buffers) has nothing to to with a heap dump, it is only a special per thread area for a young generation.
If you have better answer, please add a comment about this, thank you!