Young generation:
Most objects are initially allocated in the young generation
Old generation:
Contains objects that have survived some number of young generation collections, as well as some large objects that may be allocated directly in the old generation
Permanent generation:
Holds objects that JVM uses, such as objects describing classes and methods, as well as the classes and methods themselves.
Most objects are initially allocated in the young generation
- -XX:MaxNewSize=NNN (Maximum size of Young Generation)
- -XX:NewSize=NNN (Initial size of Young Generation)
Old generation:
Contains objects that have survived some number of young generation collections, as well as some large objects that may be allocated directly in the old generation
- -XX:NewRatio=NNN (Size of Old Generation to Young Generation)
- E.g., NewRatio=2 indicates old generation is 2/3 of total heap and young generation is 1/3 of the heap
Permanent generation:
Holds objects that JVM uses, such as objects describing classes and methods, as well as the classes and methods themselves.
- -XX:PermSize=NNN (Initial size of Perm Gen)
- -XX:MaxPermSize=NNN (Maximum size of Perm Gen)
- The young generation consists of an area called Eden plus two smaller survivor spaces
- The majority of newly created objects are located in the Eden space.
- After a GC in the Eden space, the objects are piled up into the Survivor space, where other surviving objects already exist.
- Once a Survivor space is full, surviving objects are moved to the other Survivor space. Then, the Survivor space that is full will now empty.
- The objects that survived these steps that have been repeated a number of times are moved to the old generation
No comments:
Post a Comment