What does -XX:MaxPermSize do?(-XX:MaxPermSize 有什么作用?)
问题描述
具体来说,为什么它有助于解决 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 有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:-XX:MaxPermSize 有什么作用?


基础教程推荐
- Java:带有char数组的println给出乱码 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 降序排序:Java Map 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01