1. The new generation has an Eden area and two survivor zones, first placing objects in the Eden area, and placing them on one of the survivor areas if there is not enough space, and if they still do not fit, it will trigger a minor GC that occurs in the Cenozoic. Put the surviving object in another survivor area, then empty the memory of Eden and the previous survivor area. In a GC, if you find objects that still don't fit, put those objects into memory in the old age.
2. Large objects and long-lived objects go directly into the old age zone.
3. Each time the minor GC is executed, the object to be promoted to the older age should be analyzed, and if the older objects in the old age area are now larger than the remaining size of the old age area, perform a full GC to maximize the space in the old area.
What to do: No search from the GC roots, and there are no resurrected objects after a token cleanup.
What to do: The New generation: replication cleanup; old age: Tag-purge and tag-compression algorithms; permanent: the class loader itself that holds classes in Java and loads classes.
What are GC roots:
- Referenced objects in the virtual machine stack
- Object referenced by a static property in the method area, the object referenced by the constant
- The object referenced by JNI (that is, generally speaking, the native method) in the local method stack.
Links: Java gc stuff (UP)
Links: Things to do with Java GC (bottom)
Links: Introduction to CMS garbage collector
When was the Java GC, and what did it do to something?