Is there a way to get a reference address? [duplicate]
You can get the object index with Unsafe. Depending on how the JVM is using the memory (32-bit addresses, 32-bit index, 32-bit index with offset, 64-bit address) can affect how useful the object index is. Here is a program which assumes you have 32-bit index in a 64-bit JVM. import sun.misc.Unsafe; import java.lang.reflect.Field; import java.util.Arrays; … Read more