I\'ve often heard that these methods (Object.hashCode
and System.identityHashCode
) return the address of the object, or something computed quickly from
The identityHashCode does not change for an object. So any moving is done beneath that level.
A rudimentary implementation would have a logical address --> physical address mapping for every object.
More sophisticated implementations would only have the mapping at a page level, so perhaps the last 6 bits is the memory offset, and the rest are the page id. The indirection would happen at the page id --> actual page address level.