Rules java virtual machine memory allocation of objects

Rules java virtual machine memory allocation of objects

1. Object allocation priority area in the new generation of eden, when there is not enough space eden zone when the virtual machine will launch a minor GC

Minor GC occurred in the new generation of GC, Major GC GC occurred in old age

2 years old large object directly, to avoid the release large amounts of memory copy between two survivor zones eden region

Using the new generation of replication algorithm, eden: surviror = 8: 1, so that only 10% of the replication algorithm memory will be wasted.

Programming should try to avoid short-lived large objects, very long string or array is a typical large object.

3. Long-term survival of the objects directly into the old era, if an object is defined as ages from birth each experienced a monor GC, still alive, the age to +1, when more than a certain age will enter the old era, by -XX: MaxTenuringThreshold to set the maximum age.

4. The sum of the size of the object is greater than a half of the same age survior directly into the old time, without waiting until the age threshold setting.

 

Published 415 original articles · won praise 434 · views 210 000 +

Guess you like

Origin blog.csdn.net/qq_41901915/article/details/103546861