JVM Memory Structure

Source: Internet
Author: User

JVM Memory Structure

I recently looked at some cases of Java Memory leakage and discussed it with several old buddies. I found that there are still many details that I didn't know before in the JVM. I will analyze them a little here. Let's take a look at the JVM internal structure --



The JVM memory structure mainly includes two subsystems and two components. The two subsystems are the classloader subsystem and the executionengine subsystem. The two components are the runtimedataarea component and the nativeinterface component.

Function of the classloader subsystem:

Load the content of the class file to methodarea in runtimedataarea Based on the given fully qualified name class name (such as Java. Lang. object ). Java programmers can use the extendsjava. Lang. classloader class to write their own classloader.

Role of the executionengine subsystem:

Execute the commands in classes. The core of any jvmspecification implementation (JDK) is executionengine. Different JDK, such as Sun's JDK and IBM's JDK, depend mainly on their respective executionengine.

Nativeinterface component:

Interaction with nativelibraries is an interface for interaction with other programming languages. When the native method is called, it enters a completely new world that is no longer limited by virtual machines. Therefore, it is easy to see nativeheapoutofmemory, which is not controlled by JVM.

Runtimedataarea component:

This is what we often call JVM memory. It is mainly divided into five parts --

1. Heap: Only one heap space exists in a Java virtual instance.

2. methodarea (method region): information about the mounted class is stored in the memory of methodarea. When a virtual machine loads a type, it uses the class loader to locate the corresponding class file, then reads the class file content and transmits it to the virtual machine.

3. javastack (java stack): The Virtual Machine only performs two operations on javastack directly: frame-based pressure stack or outbound stack.

4. programcounter: Each thread has its own PC register, which is also created when the thread is started. The content of the PC register always points to the next address that will be executed. The address here can be a local pointer or offset corresponding to the start instruction of the method in the method area.

5. nativemethodstack: the address for saving the native method to enter the Region

The above five parts are used only by the sharing of heap and methodarea, while javastack, programcounter, and nativemethodstack are thread-specific and each thread has its own part. This section briefly introduces the JVM memory structure.

Address: http://developer.51cto.com/art/201009/227977.htm

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.