Garbage collection - Java heap terminology young old and permanent generations

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I m trying to understand how the concepts of young , old and permanent generations in the Java heap terminology, and more specifically the interactions between the three generations.

My questions are:

    • What is the young generation?
    • What is the old generation?
    • What is the permanent generation?
    • How does the three generations interact/relate to each other?

Answers

This seems like a common misunderstanding. In Oracle s JVM, the permanent generation is not part of the heap. It s a separate space for class definitions and related data. In Java 6 and earlier, interned strings were also stored in the permanent generation. In Java 7, interned strings are stored in the main object heap.

https://blogs.oracle.com/jonthecollector/entry/presenting_the_permanent_generation https://blogs.oracle.com/jonthecollector/entry/presenting_the_permanent_generation

http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html

For the HotSpot Java VM, the memory pools for serial garbage collection are the following.
    *Eden Space (heap): The pool from which memory is initially allocated for most objects.
     *Survivor Space (heap): The pool containing objects that have survived
     the garbage collection of the Eden
    
    space.
     *Tenured Generation (heap): The pool containing objects that have existed
    
    for some time in the survivor space.
     *Permanent Generation (non-heap): The pool containing all the reflective
     data of the virtual machine itself,
     such as class and method objects. With
     Java VMs that use class data sharing,
     this generation is divided into
    
    read-only and read-write areas.
     *Code Cache (non-heap): The HotSpot Java VM also includes a code cache,
     containing memory that is used for
     compilation and storage of native
    
    code.

Java uses generational garbage collection. This means that if you have an object foo (which is an instance of some class), the more garbage collection events it survives (if there are still references to it), the further it gets promoted. It starts in the young generation (which itself is divided into multiple spaces - Eden and Survivor) and would eventually end up in the tenured generation if it survived long enough.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/2129044/java-heap-terminology-young-old-and-permanent-generations

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils