This is completely controlled by GC at that point of time. But there could be several factors that will affect such as GC strategies, GC timing etc. These could be the reasons why 50% objects are unreachable in the heap.
I analyzed the heap dump that led to the OOM error using the MAT (Memory Analyzer Tool). The total heap size was 8GB, and I found that the memory allocated by threads only amounted to 3.2GB, while unreachable objects occupied 4GB.
The garbage collector in use was G1.
Regarding your questions:
(1) Under what circumstances would there be nearly 50% of unreachable objects?
Edit your Comment