Is permanent generation part of the heap or does it lies in a different space of itself in jvm

房东的猫 提交于 2019-11-30 13:57:40
GreenMatt

Original (perhaps mistaken) answer: If wikipedia is to be believed, it's part of the heap.

Edit: I've looked around at this more, including the site referenced in a comment by the OP. During this research I came across this SO question, which references this document, which indicates that for Sun Java (version 6), the permanent collection is actually outside the heap. That said, I'm no Java expert and wasn't previously aware of the memory management details at this level. If my reading is correct, the placement - or even the existence - of the permanent generation is a jvm implementation detail.

From a blackbox perspective, in Sun JVMs, Permanent Generation is not part of the heap as stated in jconsole's documentation:

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.

In practice, this means that your -XX:MaxPermSize memory adds up to your -Xmx memory in the JVM process, as permanent generation is not included in the heap.

Here is my understanding of the topic:

The permanent generation is the region of the heap where class definitions are stored. As shown at http://blogs.oracle.com/jonthecollector/entry/presenting_the_permanent_generation, all class instances have a 'klass' reference to an instance of their type's class in the permanent generation. When new types are created at runtime, new space is allocated in the permanent generation for their types.

The diagram on Jon Masamitsu's blog post shows the logical separation between the permanent generation and the more-frequently-collected parts of the heap where your program's object instances can be stored. The permanent generation is still part of the heap.

Jiacai Liu

I came the same question when reading Java Garbage Collection Basics,in this turtorial,the author views permanent-generation is part of heap.

But we have both:

  • -Xmx
  • -XX:MaxPermSize

and after google the question,I find this questions Java heap terminology: young, old and permanent generations?,answers from which conclude:

permanent-generation is not part of heap

Permgen is removed from Java 8. Now we have metaspace which is not part of heap and part of internal memory.

Also the commands -Xmx -XX:MaxPermSize will be ignored from Java 8

http://java.dzone.com/articles/java-8-permgen-metaspace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!