JVM Memory Distribution

Source: Internet
Author: User

JVM Version 1.7:

The JVM's memory is divided into heaps and non-heap two parts.

Heap:

The heap is divided into Cenozoic and old age. Generic objects are created in the new generation of memory, and the objects in the Cenozoic are still alive after several GC recoveries (this number can be set) and moved to the old age. A GC is triggered when there is insufficient memory in the Cenozoic and older generations. The new generation of GC methods are generally replicated, while older generations are marked clean-up. method is different when used according to the characteristics of the memory of these two generational regions.

-xms512m heap initialized memory size,-xmx1024m heap maximum memory for 1024m-xmn512m cenozoic space size.

Non-heap:

Program counter: Used to record which step the thread performed (logging instructions). So each thread will have a separate counter.

Virtual Machine Stack: The information that is logged when the method is run is also thread-independent. -xss128k sets the depth of the line stacks (that is, the amount of memory the thread can use), and throws stackoverflowerror when it is exceeded.

Local method Stack: the same as the virtual machine stack, but for the native method.

Method Area: That is to say the permanent generation, used to store classes of information, constants, static variables, JIT compiled code, such as real-time. GC may not be implemented, but it will generally be. For example, class unloading will also be recycled

-xx:maxpermsize=256m set the maximum free space for the permanent generation.

string constant pool: Before JVM 1.7 is placed in the method area, 1.7 moves out of the method area, so it is no longer restricted by the MaxPermSize parameter.

Local memory: The rest of the native memory, this part of memory is not the JVM specification of memory, but the Java runtime will still use these memory, such as multi-threading, string constants, etc. will increase consumption, if not enough will OutOfMemoryError

JVM Memory Distribution

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.