Java VM Memory Model

Source: Internet
Author: User

VM Memory Model:

Thread private

1. Program countersThe ProgramCounter Register (ProgramCounter) is a small memory space. Its function can be seen as the row number indicator of the bytecode executed by the current thread.

2. Java Virtual Machine StackWhen each method is executed, a Stack Frame is created at the same time to store information such as the local variable table, Operation Stack, dynamic link, and method exit.

3. Local method StackThe local method stack is the Native method service used by virtual machines.

Thread sharing

4. HeapThe only purpose of this memory area is to store object instances, where almost all object instances allocate memory.

5. Method AreaIt is used to store data such as class information, constants, static variables, and Code Compiled by the real-time compiler loaded by virtual machines.

6. Direct MemoryThe NIO (New Input/Output) class is added to JDK 1.4, and an I/O Method Based on Channel and Buffer is introduced, it can use the Native function library to directly allocate off-heap memory, and then use a DirectByteBuffer object stored in the Java heap as a reference to this memory.

Local variable tableVarious basic data types (boolean, byte, char, short, int, float, long, and double) and object references (reference type, reference pointer, handle or other locations related to the object) and returnAddress type (pointing to the address of a bytecode instruction)

Runtime constant pool(Runtime ConstantPool) is part of the method area. In addition to the description of the version, field, method, and interface of the Class, the Class file also contains the Constant Pool Table ), it is used to store various types of literal and symbolic references generated during the compilation period. This part of content will be stored in the runtime pool of the method area after the class is loaded.

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.