Search code examples
jprofiler

Locate specific instances in snapshot comparison


Suppose I've captured 2 hprof snapshots of a running VM:

jmap -dump:format=b,file=a.hprof <pid>
jmap -dump:format=b,file=b.hprof <pid>

Now, the snapshots were taken close enough to ensure that there has been NO garbage collection at all (even a minor one) between them.

I've opened the 2 in JProfiler with compare snapshots and there's +26,911 instances of java.lang.String.

My question is: how can I view the character content for some of these strings? Since the snapshots are from the same JVM, looking at what the string value is would give me information about where it comes from.

I VisualVM you can select "Show in Instances View" which allows you to view all instances in groups of 500, but I was hoping for something more advanced in JProfiler that allows you to list the specific 26,911 instances that are extra in b.hprof (even at reference level, so if there's been a GC and stuff has been moved around, it'd still get reported as extra, but that's fine).


Solution

  • I was hoping for something more advanced in JProfiler that allows you to list the specific 26,911 instances that are extra in b.hprof

    There is no way of comparing the identity of instances in different HPROF snapshots.

    If you use the JProfiler heap dump, you can simply use the the mark heap action and then take a heap snapshot later on, and the title area will show an action to select the new instances as a new object set:

    enter image description here