finding out memory allocation hotspots in java

garbage-collection, java, jvm, memory-management, performance

Solution

For 2 and 3, you can use the `-XX:+PrintGCDetails` and `-XX:+PrintGCTimeStamps` flags with either Oracle or OpenJDK `java` executable during a run session of your application

Problem

Our GC is working hard and we have some pauses that we want to decrease. We have some memory allocation issues that we want to solve before or while we are tweaking with the actual JVM GC args. I would like to know which objects are making the GC sweat: - is there a way to know which objects are evacuated every time the GC is working? - is there a way to know which objects are moved between areas every time the GC is working? - Is there a way to know which objects are in Eden area? I am working extensively with Jprofiler and Memory Analyzer. I would like to get this information on a running application in my staging environment.

Original source