问题描述
具体来说,为什么它有助于解决 PermGen OutOfMemoryError 问题?
Specifically, why would it help to fix a PermGen OutOfMemoryError issue?
另外,如果答案指向我关于 JVM 参数的文档...
Also, bonus points for an answer that points me to the documentation on JVM arguments...
推荐答案
永久空间是 VM 使用的类、方法、内部化字符串和类似对象的存储位置,并且永远不会被释放(因此得名).
The permanent space is where the classes, methods, internalized strings, and similar objects used by the VM are stored and never deallocated (hence the name).
这篇 Oracle 文章简洁地介绍了HotSpot GC 的工作和参数化,并建议您在加载许多类时增加此空间(这通常是应用程序服务器和某些 IDE 等 Eclipse 的情况):
This Oracle article succinctly presents the working and parameterization of the HotSpot GC and advises you to augment this space if you load many classes (this is typically the case for application servers and some IDE like Eclipse) :
永久代对垃圾没有明显影响大多数应用程序的收集器性能.然而,有些应用程序动态生成和加载许多类;例如,JavaServer Pages (JSP) 页面的一些实现.这些应用程序可能需要更大的永久代来持有额外的课程.如果是这样,最大永久代大小可以使用命令行选项 -XX:MaxPermSize= 增加.
The permanent generation does not have a noticeable impact on garbage collector performance for most applications. However, some applications dynamically generate and load many classes; for example, some implementations of JavaServer Pages (JSP) pages. These applications may need a larger permanent generation to hold the additional classes. If so, the maximum permanent generation size can be increased with the command-line option -XX:MaxPermSize=.
请注意,其他 Oracle 文档列出其他 HotSpot 参数.
Note that this other Oracle documentation lists the other HotSpot arguments.
更新:从 Java 8 开始,permgen 空间和此设置都消失了.用于加载的类和方法的内存模型是不同的,并且不受限制(使用默认设置).您应该不会再看到此错误.
Update : Starting with Java 8, both the permgen space and this setting are gone. The memory model used for loaded classes and methods is different and isn't limited (with default settings). You should not see this error any more.
这篇关于-XX:MaxPermSize 有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!