Virtual Machine (2) - Object Creation

  When the virtual machine encounters a new instruction, it first checks whether the parameters of the instruction can locate a symbolic reference to a class in the constant pool. And check if the class represented by this symbolic reference has been loaded, resolved and initialized. If not, the loading process of the corresponding class must be performed first.
  After the class loading check passes, the virtual machine next allocates memory for the new object. The size of the memory required by the object is completely determined after the class is loaded.
  Object header, instance data and alignment padding.
  The object header contains two parts of information, the first part is used to store the runtime data of the object itself. Such as hash code, GC generation age, lock status flags, locks held by threads.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326770359&siteId=291194637