JVM- memory allocation and recovery strategies

 

    1. Object priority in the allocation of Eden, Eden insufficient memory, will trigger a minor gc

    2. Large objects directly into the old year

      By setting -XX: PretenureSizeThreshold, when the object is greater than this value directly assigned to the old year (using a new generation of replication algorithm, large objects are assigned to the new generation will trigger frequent replication)

    3. Long-term survival of the object will enter the old year

      Each new generation of objects through a minor gc still alive, +1 age, by setting the -XX: MaxTenuringThreshold, Mo is 15, the age when the object reaches the set age, these objects will be moved into the old year

    4. Dynamic Age Determination

      If Survior space the size of all objects of the same age, more than half of the space Survior, then aged greater than or equal to the age of an object directly into the old era, without the need to reach the age of PretenureSizeThreshold

    The space allocation guarantees

      Before minor gc occurs, the virtual machine to check whether the largest contiguous space available for the new generation of old age is greater than the total of all space objects, if the condition is true, then the minor gc to ensure it is safe.

      If the condition is not satisfied, the set value is allowed to see HandlePromotionFailure guarantee failure. If allowed, then continue to check the largest contiguous space available years old, joined to the average level is greater than the object's old.
      If so, will conduct a minor gc (although there are certain risk), or if less than HandlePromotionFailure set to not allow the security to be subject to FullGc.

      

 

    

      

Guess you like

Origin www.cnblogs.com/eason-ou/p/12195622.html