在快照比较中定位特定实例

Locate specific instances in snapshot comparison

假设我捕获了 运行 VM 的 2 个 hprof 快照:

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

现在,快照拍摄得足够接近以确保它们之间根本没有垃圾回收(即使是次要垃圾回收)。

我在 JProfiler 中打开了 2 比较快照,有 +26,911 个实例 java.lang.String。

我的问题是:如何查看其中一些字符串的字符内容?由于快照来自同一个 JVM,查看字符串值是什么可以提供有关它来自何处的信息。

I VisualVM 你可以 select "Show in Instances View" 它允许你以 500 个为一组查看所有实例,但我希望 JProfiler 中有更高级的东西,允许你列出特定的 26,911 个实例在 b.hprof 中是额外的(即使在参考级别,所以如果有 GC 并且东西已经移动,它仍然会被报告为额外的,但这没关系)。

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

无法比较不同 HPROF 快照中实例的身份。

如果您使用 JProfiler 堆转储,您可以简单地使用标记堆操作,然后稍后拍摄堆快照,标题区域将显示对 select 新实例的操作作为新 object 集: