The object overhead contains the basic information of the object; the padding bytes are used to fill the number of bytes. The bytes occupied by the object must be a multiple of 8 bytes.
The following is just an irresponsible guess: Integer inherits from Object. When constructing Integer, you must first construct Object. The object overhead is the overhead of constructing Object at this time. 8 bytes are empty objects and 4 bytes are object references. , but the byte allocation in Java is in units of 8, so 16 bytes are used here, and the useless bytes are called padding bytes. The padding bytes below are the same.
16 bytes is
Object Header
,包括了Mark word
,Class
type information...(16 bytes is the size on 64-bit systems, and pointer compression is not turned on)HotSpot's alignment is 8-byte alignment. All objects whose final size is not a multiple of 8 bytes will be filled
The object overhead contains the basic information of the object; the padding bytes are used to fill the number of bytes. The bytes occupied by the object must be a multiple of 8 bytes.
The following is just an irresponsible guess:
Integer inherits from Object. When constructing Integer, you must first construct Object. The object overhead is the overhead of constructing Object at this time. 8 bytes are empty objects and 4 bytes are object references. , but the byte allocation in Java is in units of 8, so 16 bytes are used here, and the useless bytes are called padding bytes.
The padding bytes below are the same.