Java Virtual Machine: memory area of the Java Virtual Machine

Source: Internet
Author: User

After running java, the control of memory is handed over to the java Virtual Machine. When executing a java program, the java Virtual Machine divides the memory it manages into several different data regions. The runtime memory is divided into the following parts: 1. In the program counter area, the program counter is a small memory space and a line number indicator for the bytecode executed by the current thread. Because of multithreading, each thread must have an independent program counter. Program counters between threads do not affect each other and are stored independently. Therefore, the memory area of the program counter is private to the thread. If the thread is executing a java method, this counter records the address of the Virtual Machine bytecode instruction being executed. If the native method is executed, this counter is empty. 2. the java Virtual Machine stack describes the memory call model for java method execution. the java Virtual Machine stack is also proprietary to the thread and has the same lifecycle as the thread. 3. The local method stack is the memory stack of the Native method service used by the virtual machine, and the thread is private. 4. java heap, also known as GC heap, is the largest memory managed by virtual machines and shared by all threads. It is created when the virtual machine is started to store object instances. If the heap memory is insufficient, an OutOfMemory exception is thrown. Java heap is shared by threads. 5. The method area is used to store information loaded by virtual machines, including constants, static variables, compiled code, and other data. It is also shared by threads. The Runtime Constant Pool is also part of the method 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.