What kinds of objects in Java can enter the old age

Source: Internet
Author: User

1. Big object: The so-called large object is the Java object that needs a lot of contiguous memory space, the most typical large object is that very long string and array, the memory allocation of large objects to the virtual machine is bad news, especially some short-lived large objects, which should be avoided when the program is written.

2. Long-lived objects: The virtual machine defines an object age counter for each object, and if the object survives after Eden is born and passes the first minor GC and can be accommodated by survivor, it is moved to survivor space and the object age is set to 1. Objects in the Survivor area each time minor GC, the age increases by 1, when his age to a certain extent (by default, 15 years old), will be promoted to the old age. The age threshold at which an object is promoted to an old age can be set by the parameter-xx:maxtenuringthreshold.

3. Dynamic Object Age Determination: In order to better adapt to different levels of memory, the virtual machine is not always required to be the age of the object must reach the Maxtenuringthreshold to be promoted to the old age, If the sum of all objects of the same age in Survivor space is greater than half the size of survivor space, objects older than or equal to age can enter the old age without waiting for the age required in Maxtenuringthreshold.

What kinds of objects in Java can enter the old age

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.