Java Object Header

Source: Internet
Author: User

#为了防止自己忘记, remember, I always thought that "deep understanding of Java Virtual Machine" was written wrong.

In a hotspot virtual machine, the layout of objects stored in memory can be divided into 3 areas: Object Header (header), instance data (Instance), and aligned padding (Padding).

Which means Java Object = Object Header + Instance data + object fill

The object header is made up of two parts, one for storing its own run-time data, which is called Mark Word, the other is a type pointer, and the object pointer to its class metadata.

Object Header = Mark Word + type pointer

(in case of pointer compression not turned on)

In a 32-bit system, Mark Word = 4 bytes = Three Bits, object header = 8 bytes = bits;

In a 64-bit system, Mark Word = 8 bytes = Bits, object header = bytes = 128bits;

Java Object Header

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.