System.identityHashCode() and compacting garbage collectors
- by FredOverflow
I was just wondering how System.identityHashCode() is able to always yield the same result for a given object, even if the garbage collector moves it around in memory. Does every object have an additional invisible field storing its identity, independent from its current address?