I would like to be able to get the same ID that is being used in Java heap dumps (created via jmap or JMX, etc). This is to be able to identify the live object at the still running application versus an older memory snapshot (the heap dump) of the same app.
I have already tested a little and it is obvioulsy not the hashCode, neither the JDI unique ID (which you can see in your debuggers).
From checking the code in the sun.jvm.hotspot.utilities I assume it is the objects address in memory. But also my tests with sun.misc.Unsafe didn't lead to the same id value as used in the heap dumps. (see here for some Unsafe explanation: http://zeroturnaround.com/rebellabs/dangerous-code-how-to-be-unsafe-with-java-classes-objects-in-memory/)
Any ideas? Thanks :) !