Java 中的“PermSize"是什么? [英] What is 'PermSize' in Java?

查看:33
本文介绍了Java 中的“PermSize"是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 Java 内存管理 并且我遇到了我无法理解的 PermSize.该文档说它存储JVM 存储其元数据",但我无法完全理解元数据的含义.我在谷歌上搜索,在我读到的某个地方存储了一个值对象(用户定义的对象).

I was going through the document in Java Memory Management and in that I came across PermSize which I couldn't understand. The document says that it stores, "JVM stores its metadata", but I couldn't exactly get what is meant by metadata. I was googling and somewhere I read it stores a value object (user defined object).

那里存储了什么样的对象?一个有解释的例子会很棒.

What kind of objects are stored there? An example with an explanation would be great.

推荐答案

永久代"的快速定义:

"永久代用于保存 VM 本身的反射数据比如类对象和方法对象.这些反光物体是直接分配到永久一代,它的大小独立于另一个几代人."[ref]

"The permanent generation is used to hold reflective data of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations." [ref]

换句话说,这就是类定义的所在(这解释了为什么在应用程序加载大量类和/或重新部署时您可能会收到消息OutOfMemoryError: PermGen space).

In other words, this is where class definitions go (and this explains why you may get the message OutOfMemoryError: PermGen space if an application loads a large number of classes and/or on redeployment).

请注意,PermSize 是用户在 JVM 选项上设置的 -Xmx 值的附加值.但是 MaxPermSize 允许 JVM 能够将 PermSize 增长到指定的数量.最初加载 VM 时,MaxPermSize 仍将是默认值(-client 为 32mb,-server<为 64mb/code>) 但在需要之前不会实际占用该数量.另一方面,如果您将 PermSizeMaxPermSize 都设置为 256mb,您会注意到在 -Xmx 设置的基础上,整体堆增加了 256mb.

Note that PermSize is additional to the -Xmx value set by the user on the JVM options. But MaxPermSize allows for the JVM to be able to grow the PermSize to the amount specified. Initially when the VM is loaded, the MaxPermSize will still be the default value (32mb for -client and 64mb for -server) but will not actually take up that amount until it is needed. On the other hand, if you were to set BOTH PermSize and MaxPermSize to 256mb, you would notice that the overall heap has increased by 256mb additional to the -Xmx setting.

这篇关于Java 中的“PermSize"是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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