Two questions about the Java memory mechanism

Source: Internet
Author: User

Question 1.

In the younger generation of Java heap memory, case: If the minor GC occurs, the to survivor area has insufficient space to accommodate the surviving objects from Eden and from survivor. Background: This time there is no age to reach Maxtenuringthreshold object, nor does the same age object size sum of more than half of the survivor space problem: How does Java Virtual opportunity handle this situation? It is supposed to move a part of the object into the old age, so the question is, how many objects will be moved into the old generation?


Question 2.

The book says: In Java heap memory, if the sum of all objects of the same age in Survivor space is greater than half the size of survivor space, then objects older than or equal to that age can enter the old generation directly, No need to wait for the age required in Maxtenuringthreshold. The problem is that each time the GC is minor, the age of the objects in the survivor is added to 1, and the age of the objects from Eden should be 1, so that from a Survivor the object never has the same age that the sum of the size of the object is greater than half of the survivor space occurs, And the only things that can happen are objects from Eden (their age is 1), so if the sum of all objects from the Eden area is greater than half of the survivor space, the objects from Eden and from Survivor will be brought into the next year!!! It feels unreasonable, so I want to know what's wrong with my understanding?


Please help to answer the question?

Two questions about the Java memory mechanism

Related Article

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.