Is java PermGen space part of the total VM memory?

2019-02-08 15:16发布

Assuming I start my java VM with the following parameters:

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

Do the 512m PermGen space add to the 1024m memory or are they part of it? Or in other words, do I have a total memory consumption of 1536m or of 1024m? In the latter case, does that mean that the application has only 512m for purposes other than PermGen space?

Please let me know in case this question reveals a lack of understanding PermGen space. ;-)

3条回答
smile是对你的礼貌
2楼-- · 2019-02-08 16:03

In Sun's JVM, the permanent generation is not part of the heap. It's a different space for class definitions and related data, as well as where interned strings live.

查看更多
Juvenile、少年°
3楼-- · 2019-02-08 16:13

I just bumped on this page through 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". 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. The permanent generation is populated by the JVM at runtime based on classes in use by the application. In addition, Java SE library classes and methods may be stored here.

查看更多
Luminary・发光体
4楼-- · 2019-02-08 16:18

The -Xms and -Xmx parameters refer to heap memory, whereas the PermGen space is a separate memory pool.

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.

查看更多
登录 后发表回答