Permgen是否是堆的一部分? [英] Permgen is part of heap or not?

查看:129
本文介绍了Permgen是否是堆的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从官方oracle网站上找到了图片



但在流行的



然后在上面的第三个链接中,您可以参考内存测量在第3.2节测量中已经完成,这也表明永久代不是堆区的一部分。

另外,你会知道,在满载在Tenured generation中的GC,在最糟糕的情况下,JVM会抛出内存异常,但不会将对象提升为永久生成,因为它不属于堆区。



< h1>非Oracle引用

检查下图,并且可以找到许多这样的图解释JVM的内存调整参数。如果你从内存中看到调优JVM参数的观点,那么不言而喻,永久代不是堆区的一部分。



最后



现在,我认为您应该清楚图(及其文章)只是为了从代角度解释JVM内存概念,但在实现中,JVM并不认为永久代是堆内存的一部分,它可以促进长寿命对象。


I have found picture from official oracle site

but in popular SO answer I have found that permanent generation is not part of heap

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.

I messed with these contradictory datas. I believe that at both places data valid but with reservations. Please clarify this question for me.

P.S.

let speak only about Sun/Oracle jvms.

P.S.2

I have read explanation of jvm gcs(serial,parallel, cms and g1) and I didn't see mentions about permgen it argument to side that permanent generation is not heap part.

解决方案

I believe you are referring the diagram from here, about Oracle's official site, and yes they are quoting "permanent generation" as heap area but I guess intent was just trying to explain the "generations" in JVM memory; but as per best of my knowledge (and I guess many experts will agree with it) "permanent generation" is not part of heap area, it is part of non-heap area which is used by JVM to internal purpose like JIT optimization, method areas etc.

Oracle official references

I would like to quote below 3 official Oracle references to help you get convinced that "permanent generation" is not part of heap area.

  1. jConsole guide from Oracle.
  2. Blog of a Oracle GC developer.
  3. Oracle article on GC tuning

In the first link above, you can clearly see that it is explained that Java manages 2 kind of memory - Heap and Non-Heap Memory, and then they have listed "generations" present in each type of memory. You can read this section in the link "Monitoring Memory Consumption", and below is some excerpt.

Then in the second link from above, GC developer has very well explained the purpose and insight of "permanent generation", using which it can be clearly understood that "permanent generation" is not a heap area, see below diagram from the blog:

Then in the third link from above, you can refer the memory measurements done in section 3.2 "Measurement", which also makes it clear that "permanent generation" is not part of heap area.

Also, you would know that after a full GC in "Tenured generation", in worst case JVM would throw out of memory exception but would not promoted the objects to "permanent generation" because it is not part of heap area.

Non-Oracle references

Checkout below diagram, and many such diagrams can be found which explains the memory tuning arguments of JVM. If you see from memory tuning JVM arguments perspective as well then also it is self-evident that "permanent generation" is not part of heap area.

In the end

Now, I think it should be clear to you that the diagram (and its article) was just meant to explain the JVM memory concept from "generations" perspective, but in implementation JVM doesn't consider "permanent generation" to be part of heap memory where it can promote the long-lived objects.

这篇关于Permgen是否是堆的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆