JVM (1)

Source: Internet
Author: User
Tags xms

I learned about JVM, but I don't know what it is. Later, I learned a little about it, which means that the source code written in Java can be run only after being edited by the JDK tool and compiled into a language that can be recognized by the Java Virtual Machine. This is a preliminary understanding.

JVM is the environment where Java program runs and has its own life cycle.

To learn about the relationship between JVM and memory overflow, first understand what memory overflow is.

Memory overflow: the memory allocated to the Java Virtual Machine exceeds the memory allocated by the system, and the system cannot meet the requirements.

Memory leakage: refers to the usage of the allocated memory you applied to the system. If the memory is used up, it is not returned, and there is no Delete, the memory that is applied for allocation cannot be accessed by yourself, it cannot be reused. As the server continuously consumes memory, it will generate more and more memory that cannot be used. The system cannot allocate it to other required programs, resulting in Memory leakage, if the program has no memory usage, memory overflow will occur.

Sun JDK divides the memory into Method Area, heap, JVM method stack, local method stack, and PC register according to the JVM specification.

Method Area: stores information about the classes and interfaces to be loaded, static variables, constants, and related data obtained through the Class Object. This area becomes persistent, with a default value of 16 Mb, the maximum value is 64 mb. You can use-XX: permsize and XX: maxpermsize to set the maximum and minimum values.

Heap: heap memory, which stores instances and array values. The memory occupied by heap objects is recycled by GC. the maximum size of heap objects in 32-bit systems is 2 GB, And the 64-bit system size is unlimited, it can be controlled through-XMS and-xmx.-XMS is the minimum heap memory applied during JVM startup, and-xmx is the maximum memory that can be applied by JVM.

Method Stack: Each thread creates a PC register and method stack. The method stack is private to the thread. After the method is run, the space occupied by the method's website will be automatically released, method stack space is insufficient. You can set it through-XSS.

The new generation is composed of the Eden region and two zookeeper vor spaces of the same size. The new generation size can be determined through-xmn,

The object was created by the new generation and stored in the Garden of Eden. When the Garden of Eden is full, the JVM Garbage Collector recycles the object and the unused object will be destroyed, objects that are still in use are transferred to S0. After S0 is full, they are transferred to S1.

The old generation stores objects that are still used for survival after repeated garbage collection, such as cache objects. The occupied size is the xmx value-xmn value.


JVM (1)

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.