) JVM Memory Allocation

Source: Internet
Author: User
Heap memory is divided into two parts: new and old,

The new Part includes the newly created object area and two movie vor areas (SS #1 and SS #2). The newly created object is allocated with a new object, long-lived objects are moved to the old part. Perm is a permanent Region allocated to the JVM in this province. You can set it using the command line parameter-XX: maxpermsize = 64 m.

When new is filled up, the "Auxiliary" GC will be triggered to move objects that have been in the old state for a long time. When old is also filled up, the "Main" GC will be triggered to traverse all objects in the heap memory. It can be seen that the "Main" GC consumes more time. New with a large enough size will be suitable for objects that need to be created for a large number of objects with a short time. If old is not enough, it will trigger the "Main" GC frequently, greatly reducing the performance. Therefore, our task is to set the heap memory size and plan the ratio of the New and Old areas to fit our application.

"Auxiliary" GC use copy/scavenge collectionAlgorithm, "Main" GC uses mark-compact collection.

Example: Java-server-XX: newsize = 128 M-XX: maxnewsize = 128 M-XX: Export vorratio = 8-xms512m-xmx512m server application name

1) set-the size of-XMS and-xmx to be equal, so as to avoid adjusting the heap memory size after each GC.
2) Similarly, newsize and maxnewsize are equal. The size of "new" should not be greater than half of "old ".

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.