NOTE

How JVM References Locate Objects

Direct-pointer and handle-based object-reference models, and why Java code should not depend on a particular physical object-address representation.

JavaCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

A Java reference is an abstract language/JVM value, not a portable raw memory address.

Two classic implementation strategies are:

  • direct pointer: the reference points to an object representation directly;
  • handle: the reference points through an intermediate handle that can contain object/class pointers.

HotSpot has traditionally used direct object references in common configurations, but compression, GC barriers, relocation, and collector implementation details affect representation.

Application code should rely on object identity and reference semantics, not physical addresses. A moving collector may relocate an object while preserving Java-level reference correctness.

Loading helpful count