& Lt; deep dive into Java Virtual Machine & gt;-Chapter 2-java memory area-learning notes, java-Java

Source: Internet
Author: User

<Deep into Java Virtual Machine>-Chapter 2-java memory area-learning notes, java-Java
Java runtime memory Zone

When running a Java program, the Java Virtual Machine divides the memory areas it manages into multiple different areas. Each region has its own purpose, Creation Time, and destruction time. Some exist with the startup of virtual machines, and some rely on user threads to start and destroy them.

  • Handle

    The Java heap divides a piece of memory into a handle pool, and the reference stores the handle address of the object, the handle contains the specific address information of the instance data and type data of the object.

  • Direct pointer

    With direct pointer access, the object address is directly stored in the reference.

Advantages and disadvantages of the two access methods:

The biggest advantage of using handle access is that the reference stores a stable handle address, which is very common when objects are moved during garbage collection) you only need to modify the instance data pointer in the handle, and the reference itself does not need to be modified.

The biggest advantage of direct pointer access is faster speed, which saves the time overhead of one intermediate pointer location, and the object access is very frequent in Java, this kind of overhead is also a considerable execution cost.

Different vendors have different virtual machines. Sun HotSpot virtual machines use direct pointer access for object access.

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.