What is perm space?

后端 未结 10 1756
日久生厌
日久生厌 2020-11-28 02:10

While learning about java memory profiling, I keep seeing the term \"perm space\" in addition to \"heap.\" I know what the heap is - what\'s perm space?

相关标签:
10条回答
  • 2020-11-28 02:47

    Perm space is used to keep informations for loaded classes and few other advanced features like String Pool(for highly optimized string equality testing), which usually get created by String.intern() methods. As your application(number of classes) will grow this space shall get filled quickly, since the garbage collection on this Space is not much effective to clean up as required, you quickly get Out of Memory : perm gen space error. After then, no application shall run on that machine effectively even after having a huge empty JVM.

    Before starting your application you should java -XX:MaxPermSize to get rid of this error.

    0 讨论(0)
  • 2020-11-28 02:50

    It holds stuff like class definitions, string pool, etc. I guess you could call it meta-data.

    0 讨论(0)
  • 2020-11-28 02:56

    The permgen space is the area of heap that holds all the reflective data of the virtual machine itself, such as class and method objects.

    0 讨论(0)
  • 2020-11-28 02:56

    Permgen space is always known as method area.When the classloader subsystem will load the the class file(byte code) to the method area(permGen). It contains all the class metadata eg: Fully qualified name of your class, Fully qualified name of the immediate parent class, variable info, constructor info, constant pool infor etc.

    0 讨论(0)
  • 2020-11-28 03:07
    • JVM has an internal representation of Java objects and those internal representations are stored in the heap (in the young generation or the tenured generation).
    • JVM also has an internal representation of the Java classes and those are stored in the permanent generation

    enter image description here

    0 讨论(0)
  • 2020-11-28 03:08

    Perm Gen stands for permanent generation which holds the meta-data information about the classes.

    1. Suppose if you create a class name A, it's instance variable will be stored in heap memory and class A along with static classloaders will be stored in permanent generation.
    2. Garbage collectors will find it difficult to clear or free the memory space stored in permanent generation memory. Hence it is always recommended to keep the permgen memory settings to the advisable limit.
    3. JAVA8 has introduced the concept called meta-space generation, hence permgen is no longer needed when you use jdk 1.8 versions.
    0 讨论(0)
提交回复
热议问题