Java Memory Area

Source: Internet
Author: User

Method Area: Used to store data such as class information, constants, static variables, compiler-compiled code, etc. that have been loaded by the virtual Machine. When the method area does not meet the memory allocation requirements,will throwOutOfMemoryError Exception.
The method area is Thread-shared.

Heap: Created at virtual machine startup to hold object instances and array Elements. If there is no memory in the heap to complete the instance assignment, and the heap cannot be expanded, it throwsOutOfMemoryError Exception.
the heap is Thread-shared.

Virtual Machine Stack: The virtual machine stack 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: A local variable that is used to store method parameters and method internal Definitions.operand Stacks: Used to store variable data during method execution, such as Byte-code instruction for integer addition iadd two int elements from the top of the stack, perform an add operation, and then add the result into the STACK.    Dynamic Links: A large number of symbolic references exist in a constant pool of class files, and the method invocation directives in bytecode are used as parameters in a constant pool to point to a Method's symbolic reference. Some of these symbolic references are converted to direct references when the class is loaded or used for the first time, and this conversion is called static parsing. The other part is converted to a direct reference during each run, which is called dynamic linking.Method Export: When a method starts executing, there are only two ways to exit this method: one is the bytecode instruction that the execution engine encounters with the method, which is called the normal completion exit, and the other is an exception encountered during the execution of the method, and the exception is not processed in the method body, which causes the method to Exit. This exit method is called abnormal completion of the Exit.    A method exits with an exception completion exit, and is not returned to its upper-level caller to produce any return Value. The stack depth of a thread request is greater than the depth allowed by the virtual machine, and the Stackoverflowerror exception will be thrown if the virtual machine stack can be dynamically extended, but the extension cannot request enough memory to throwOutOfMemoryError Exception.
the virtual machine stack is Thread-private.

Local Method Stack: The local method stack is similar to the virtual machine stack function, except that the local method stack serves the native method. The local method stack will also throwstackoverflowerror Exceptions and OutOfMemoryError exceptions.
The local method stack is Thread-private.

Program Counter: The line number indicator for the bytecode executed by the current thread lock. If the thread is executing a Java method, the counter records the address of the executing virtual machine season instruction, and if the native method is being executed, the counter has a value of NULL (Undefined). OutOfMemoryError does not appear in this Area.    Program counters are Thread-private.

Java Memory Area

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.