Java 對象頭 以 32 位虛擬機為例
普通對象
|--------------------------------------------------------------| | Object Header (64 bits) | |------------------------------------|-------------------------|
|
Mark Word (32 bits)
|
Klass Word (32 bits)
|
|
一鍵獲取完整項目代碼
|
|
|
java
|
|
|
數組對象
|
|
|---------------------------------------------------------------------------------| | Object Header (96 bits) | |--------------------------------|-----------------------|------------------------|
|
Mark Word(32bits)
|
Klass Word(32bits)
|
array length(32bits)
|
|
一鍵獲取完整項目代碼
|
|
|
|
java
|
|
|
|
其中 Mark Word 結構為
|
|
|
|-------------------------------------------------------|--------------------|
|
Mark Word (32 bits)
|
State
|
|
hashcode:25
|
age:4
|
|
-------------------------------------------------------
|
--------------------
|
|
thread:23
|
epoch:2
|
|
-------------------------------------------------------
|
--------------------
|
|
ptr_to_lock_record:30
|
00
|
|
-------------------------------------------------------
|
--------------------
|
|
ptr_to_heavyweight_monitor:30
|
10
|
|
-------------------------------------------------------
|
--------------------
|
|
|
11
|
|
-------------------------------------------------------
|
--------------------
|
|
一鍵獲取完整項目代碼
|
|
|
java
|
|
64 位虛擬機 Mark Word
|--------------------------------------------------------------------|--------------------|
|
Mark Word (64 bits)
|
State
|
|
unused:25
|
hashcode:31
|
|
--------------------------------------------------------------------
|
--------------------
|
|
thread:54
|
epoch:2
|
|
--------------------------------------------------------------------
|
--------------------
|
|
ptr_to_lock_record:62
|
00
|
|
--------------------------------------------------------------------
|
--------------------
|
|
ptr_to_heavyweight_monitor:62
|
10
|
|
--------------------------------------------------------------------
|
--------------------
|
|
|
11
|
|
--------------------------------------------------------------------
|
--------------------
|
|
一鍵獲取完整項目代碼
|
|
|
java
|
|
———————————————— 版權聲明:本文為CSDN博主「向着五星的方向」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。 原文鏈接:https://blog.csdn.net/qq_69748833/article/details/136977618