Search code examples
javagarbage-collectionjvmprofilingescape-analysis

profiling the jvm where most garbage is generated and what type it has, escape analysis optimization


I know that my program invokes the gc in regular intelvals, but I would like to analyse only the generated garbage. I want to know which classes are most frequently abandoned, and much more important, where are those instances created. Generally I want to optimize for escape analysis to reduce the garbage collection to a minimum.

Edit: I am not interested in live objects.


Solution

  • JProfiler gives you statistics about garbage collected objects. The allocation tree and hot spots even show you where they have been created.

    In the "Recorded objects" view, change the "Liveness mode" to "Garbage collected objects":

    enter image description here

    Disclaimer: My company develops JProfiler.