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

Source: Internet
Author: User

Chapter two Java memory area and memory overflow exception run-time data region

Program counter (Counter Register)

Program counter : The byte code line number indicator that the current thread executes. The counters between the threads do not affect each other and are stored independently. Also known as "thread-private" memory.

PS: When the native method is executed, the counter value is empty (Undefined). This memory area is the only area in the Java Virtual Machine specification that does not specify any outofmemoryerror conditions.

Java VM Stack (Java Virtual machine Stacks)

? Describes the memory model that the Java method executes: Each method creates a stack frame to store information such as 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 virtual machine stack into the stack of the process.

Local variable table

? Contains the various basic data types (Boolean, Byte, char, short, int, float, long, double), object reference (reference type, which is not equivalent to the object itself, possibly a reference pointer to the starting address of the object) , or to a handle that represents an object or other location associated with the object) and the ReturnAddress type (the address that points to a bytecode directive)

Stackoverflowerror exception

? Thread request has a stack depth greater than the virtual machine allows

OutOfMemoryError exception

? The virtual machine stack can be dynamically extended (most of the current Java virtual machines can be dynamically extended, but the Java Virtual Machine specification also allows a fixed-length virtual machine stack), if the extension cannot request enough memory.

Local methods Stack (Native method Stacks)

? The difference from a virtual machine stack is that the local method stack executes the native method.

Java heap (Java heaps)

? The Java heap is shared by all threads and is created when the virtual machine is started. Used to hold object instances: All object instances and arrays are allocated on the heap (not absolute).

? Division: The new Generation and the old age.

? A little more detailed is Eden space, from Survivor space, to survivor space and so on.

Method area

? Thread sharing.

? Used to store data such as class information, constants, static variables, immediate compiler-compiled code, etc. loaded by the virtual machine

Run a constant pool (runtime Constant)

? Part of the method area.

    • Chang (Constant Pool): Constant pool Data compilation period is determined and is part of the class file. Constants in classes, methods, interfaces, and so on are stored, including string constants, of course.
    • String Pool/String Chang (String pool/string Constant Pool): is a part of a constant pool that stores the string type data produced in the compilation period class.
    • Run a constant pool (runtime Constant Pool): Part of the method area, shared by all threads. After the virtual machine loads the class, it puts the data in the constant pool into the run-time pool.

In-depth understanding of Java Virtual Machine Learning 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.