Java Advanced (one) JVM Runtime memory model

Source: Internet
Author: User

1.JVM run-time data region partitioningA. Procedure counter (program Counter Register)

A small piece of memory space, which can be seen as the line number indicator of the byte code executed by the current thread. Each thread has a separate counter, and if the native method is currently executing, the counter value is empty.

B.JVM Stack (Java Virtual machine Stack)

Describes the memory model that Java methods perform, each of which creates a stack frame (Stacks frame) for storing local variable tables, operand stacks, dynamic links, method exits, and so on.

Each method from the call until the completion of the process, corresponding to a stack frame in the JVM stack into the stack to the process.

C. Local methods Stack (Native method Stack)

The role of the JVM stack is very similar, except that the JVM stack executes Java method Services for the JVM, while the local method stack serves the native method used by the JVM.

D.java Heap (Java heap)

The Java heap is a piece of memory that is shared by all threads and created when the JVM is started. All object instances and arrays are allocated memory here, but as the JIT compiler progresses, it becomes less absolute.

E. Method area

Stores data such as class information, constants, static variables, and instant compiler-compiled code that have been loaded by the JVM.

Although the JVM specification describes a method area as a logical part of a heap, it has an alias called Non-heap.

F. Running a constant-rate pool (runtime Constant)

Part of the method area. In addition to descriptive information such as versions of classes, fields, methods, interfaces, and so on, there is a constant pool that holds the various literal and symbolic references generated by the compiler.

G. Direct memory

is not part of the JVM Runtime data area, nor is it a memory area defined in the JVM specification.

For example, the newly introduced NIO (new Input/output) class in JDK1.4, a channel-and buffer-based I/O method, can operate the out-of-heap memory directly using the native library. The Directbytebuffer object stored in the Java heap is then used as a reference to this memory to avoid copying data back and forth in the Java heap and the native heap.




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.