Java memory allocation and parameter configuration __ Technical topics

Source: Internet
Author: User
First, the object priority in the new generation Eden area allocation heap memory size is 20M, not automatic expansion, the Cenozoic memory is 10M, the default Eden area: Survivor area for the 8:1,eden area is: 10mx8/10=8129kb,survivor area size is 1024KB, The new generation total available memory is 9216KB. When the new generation does not fit, it will lease the old era of the region.
Two, large objects directly into the old age-xx:pretenuresizethreshold (only for serial and parnew collectors) greater than the parameter configuration value will be assigned directly in the old age.
Third, the long-term survival of the object will enter the old age virtual machine designed an object age counter, if the object in the Eden area was born and after the first minor GC still survive, and can be accommodated in the Survivor area, is copied to the Survivor area and the object age is set to 1. After each time the object is minor GC, the object age is +1. When the object age exceeds the age of the object to be promoted to the ages threshold (default is 5), then promoted to the old age. -xx:maxtenuringthreshold
Full GC is usually accompanied at least once minor GC (not absolute)
Iv. Dynamic Object Age determination if the survivor area is the same age, the sum of all object sizes is greater than half of the survivor space, and objects older than or equal to that age are copied to the old age at minor GC.
Although the minor GC does not have enough space in the survivor area to lease the old age memory when it completes the GC, a reference to the old age leased memory start address is still preserved in the survivor area.
V. Space allocation guarantee when the minor GC is triggered, the virtual opportunity first detects whether the average size of the old age memory before the GC is larger than the remaining memory in the old age, and if it is greater than, the minor GC becomes a full GC, and if less, see if the virtual machine is allowed to fail. If the guarantee fails, then only the minor GC is executed, otherwise the minor GC is changed to a full GC (until the GC ends to determine how many objects need to be moved to the old age, so only a rough average is used before the GC).
Heap memory JVM The initial allocation of heap memory is specified by-XMS, and the default is the 1/64;JVM maximum allocated heap memory of physical memory is specified by-XMX, which defaults to 1/4 of physical memory. Non-heap memory allocation JVM uses-xx:permsize to set the non heap memory initial value, the default is 1/64 of physical memory, set by-xx:maxpermsize maximum non heap memory size, default is 1/4 of physical memory.
GC does not clean up the PermGen space during the main program run, so your app will load a lot of classes and there may be permgen space errors.

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.