简体   繁体   English

java PermGen空间是整个VM内存的一部分吗?

[英]Is java PermGen space part of the total VM memory?

Assuming I start my java VM with the following parameters: 假设我使用以下参数启动我的Java VM:

-Xms1024m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m

Do the 512m PermGen space add to the 1024m memory or are they part of it ? 512m PermGen空间是否会添加到1024m内存中,还是它们的一部分 Or in other words, do I have a total memory consumption of 1536m or of 1024m? 或者换句话说,我的总内存消耗是1536米还是1024米? In the latter case, does that mean that the application has only 512m for purposes other than PermGen space? 在后一种情况下,这是否意味着应用程序只有512m用于PermGen空间以外的目的?

Please let me know in case this question reveals a lack of understanding PermGen space. 如果这个问题显示对PermGen空间缺乏了解,请告诉我。 ;-) ;-)

The -Xms and -Xmx parameters refer to heap memory, whereas the PermGen space is a separate memory pool. -Xms-Xmx参数指的是内存,而PermGen空间是一个单独的内存池。

In other words, the total memory size available to your Java application will be 1.5 GiB rather than 1 GiB, and you'll get the full gigabyte of space for heap-allocated objects. 换句话说,Java应用程序可用的总内存大小将是1.5 GiB而不是1 GiB,并且您将获得堆分配对象的完整千兆字节空间。

I just bumped on this page through Google. 我刚刚通过Google碰到了这个页面。 This is certain confusion whether PerGen is part of Heap or not: The answer is "Heap is broken up into smaller parts/generations and these parts are: Young Generation, Old or Tenured Generation, and Permanent Generation". PerGen是不是Heap的一部分,这是一定的混淆:答案是“堆被分解成更小的部分/代,这些部分是:年轻一代,老一代或终身代,永久代”。 This is what Oracle says to say the least. 这就是甲骨文所说的至少。 It makes much more sense to go by what originator says than by the audience on the web domain. 通过发起者所说的比通过网络域的受众更有意义。

A short note on PermGen: Permanent generation contains metadata required by the JVM to describe the classes and methods used in the application. 关于PermGen的简短说明:永久生成包含JVM描述应用程序中使用的类和方法所需的元数据。 The permanent generation is populated by the JVM at runtime based on classes in use by the application. JVM在运行时根据应用程序使用的类填充永久代。 In addition, Java SE library classes and methods may be stored here. 此外,Java SE库类和方法可以存储在此处。

In Sun's JVM, the permanent generation is not part of the heap. 在Sun的JVM中,永久代不是堆的一部分。 It's a different space for class definitions and related data, as well as where interned strings live. 它是类定义和相关数据的不同空间,也是实习字符串所在的空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM