In-depth understanding of Java Virtual Machine reading notes (i)

Source: Internet
Author: User

1, program counter -

Occupied space: smaller

function: byte code line number indicator

Function Details: Indicates instruction execution, such as (bytecode execution, branching, looping, jumping, exception handling, thread recovery)

Features: thread-Private (each counter is calculated independently, context is independent of each other).

2. Virtual Machine stack

Occupied space: According to the stack space setting

Role: The memory model that the Java method executes.

Function Details: The stack frame is created when each method executes. Used to store local variable table , stack operand , dynamic Link , method exit and other information. each method from the call to the completion of the execution of the corresponding stack frame in the virtual machine stack into the stack of the process

Features: thread-Private

3. Local Method Stack

The local method stack is very similar to the virtual machine stack, but the difference between them is that the virtual machine stack is the Java Method bytecode service, and the local method stack is the Native method Service (Native). In the virtual machine specification, the language used for local methods and the use of methods and data structures are not mandatory, so the specific virtual machine can be implemented freely.

4. Heap

The heap is the largest piece of Java Virtual machine.

Function: Holds the object instance.

Features: Thread sharing.

Problems may occur: memory leaks, multithreading reference preemption.

Virtual Machine Solution: GC recovery, CAS retry mechanism lock.

5. Method area

Function: Used to store data such as the class information loaded by the virtual machine, constants, static variables, the immediate compiler compiled code , and so on.

Features: Thread sharing

6, Chang

Function: is a part of the method area that holds the various literal and symbolic references generated by the compiler, which are stored in the class load backward-entry method area.

Features: Another important feature of the constant pool relative to the class file is its dynamic nature, with the possibility of a new constant pool being put into discreet, such as the String.intern () method during run time.

7. Direct Memory:

is not part of the memory area defined in the virtual machine, but is out of heap memory.

NiO can directly manipulate out-of-heap memory

In-depth understanding of Java Virtual Machine reading notes (i)

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.