Java PermGen 实际上代表什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/318942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does PermGen actually stand for?
提问by SCdF
I know what PermGen is, what it's used for, why it fails, how to increase it etc.
我知道 PermGen 是什么,它的用途是什么,它为什么会失败,如何增加它等等。
What I don't know is what PermGen actually stands for. Permanent... Gen... something?
我不知道 PermGen 实际上代表什么。永久……将军……什么东西?
Does anyone know what PermGen actually stands for?
有谁知道 PermGen 实际上代表什么?
采纳答案by Tom Hawtin - tackline
Permanent Generation. Details are of course implementation specific.
永久一代。细节当然是特定于实现的。
Briefly, it contains the Java objects associated with classes and interned strings. In Sun's client implementation with sharing on, classes.jsa
is memory mapped to form the initial data, with about half read-only and half copy-on-write.
简而言之,它包含与类和内部字符串相关联的 Java 对象。在 Sun 的共享客户端实现中,classes.jsa
内存映射以形成初始数据,大约一半是只读的,一半是写时复制的。
Java objects that are merely old are kept in the Tenured Generation.
仅旧的 Java 对象保留在 Tenured Generation 中。
回答by Dustin
Permanent Generation. See the java GC tuning guidefor more details on the garbage collector.
永久一代。有关垃圾收集器的更多详细信息,请参阅 java GC 调优指南。
回答by Rob Kennedy
回答by Uri
If I remember correctly, the gen stands for generation, as in a generational garbage collector (that treats younger objects differently than mid-life and "permanent" objects). Principle of locality suggests that recently created objects will be wiped out first.
如果我没记错的话,gen 代表代,就像在分代垃圾收集器中一样(它对较年轻的对象的处理方式与中年和“永久”对象不同)。局部性原则建议最近创建的对象将首先被清除。
回答by Michael Easter
回答by bajafresh4life
PermGen is used by the JVM to hold loaded classes. You can increase it using:
JVM 使用 PermGen 来保存加载的类。您可以使用以下方法增加它:
-XX:MaxPermSize=384m
-XX:MaxPermSize=384m
if you're using the Sun JVM or OpenJDK.
如果您使用的是 Sun JVM 或 OpenJDK。
So if you get an OutOfMemoryException: PermGen you need to either make PermGen bigger or you might be having class loader problems.
因此,如果您收到 OutOfMemoryException: PermGen,您需要将 PermGen 变大,否则您可能会遇到类加载器问题。
回答by Alex K.
Not really related match to the original question, but may be someone will find it useful. PermGen is indeed an area in memory where Java used to keep its classes. So, many of us have came across OOM in PermGen, if there were, for example a lot of classes.
与原始问题没有真正相关的匹配,但可能有人会发现它很有用。PermGen 确实是 Java 过去用来保存其类的内存区域。所以,我们中的许多人都在 PermGen 中遇到过 OOM,如果有的话,例如很多类。
Since Java 8, PermGen area has been replaced by MetaSpace area, which is more efficient and is unlimited by default (or more precisely - limited by amount of native memory, depending on 32 or 64 bit jvm and OS virtual memory availability) . However it is possible to tune it in some ways, by for example specifying a max limit for the area. You can find more useful information in this blog post.
从 Java 8 开始,PermGen 区域已被 MetaSpace 区域取代,后者更高效且默认无限制(或更准确地说 - 受本机内存量的限制,取决于 32 或 64 位 jvm 和操作系统虚拟内存可用性)。但是,可以通过某些方式对其进行调整,例如指定区域的最大限制。您可以在这篇博文中找到更多有用的信息。
回答by Sumanth Varada
Permgen stands for Permanent Generation. It is one of the JVM memory areas. It's part of Heap with fixed size by using a flag called MaxPermSize.
Permgen 代表永久代。它是 JVM 内存区域之一。它是通过使用名为 MaxPermSize 的标志固定大小的堆的一部分。
Why the name "PermGen" ?
为什么叫“PermGen”?
This permgen was named in early days of Java. Permgen mains keeps all the meta data of loaded classes. But the problem is that once a class is loaded it'll remain in the JVM till JVM shutdown. So name permgen is opt for that. But later, dynamic loading of classes came into picture but name was not changed. But with Java 8, they have addressed that issue as well. Now permagenwas renamed as MetaSpacewith dynamic memory size.
这个 permgen 是在 Java 早期命名的。Permgen mains 保存加载类的所有元数据。但问题是,一旦加载了一个类,它就会保留在 JVM 中,直到 JVM 关闭。所以名称 permgen 是选择的。但是后来,类的动态加载出现了,但名称没有改变。但是在Java 8 中,他们也解决了这个问题。现在permagen被重命名为具有动态内存大小的MetaSpace。