简体   繁体   English

内存不足的PermGen空间

[英]OutOfMemory PermGen space

I'm getting an OutOfMemory: PermGen space error when running my application. 运行我的应用程序时出现内存不足:PermGen空间错误。 A brief description: 简要说明:

The error does not occur when running from the source code, but it does occur when I run from the deployed .jnlp launcher. 从源代码运行时不会发生该错误,但是从已部署的.jnlp启动器运行时会发生该错误。 The error occurs in a screen that retrieves data from our company database via RMI. 该错误发生在通过RMI从我们公司数据库检索数据的屏幕中。 Running from the source code and from the launcher both use the same RMI url. 从源代码和启动器运行都使用相同的RMI url。 Running from the source code and from the launcher both use the same Java version (6_38). 从源代码和启动器运行都使用相同的Java版本(6_38)。 The app is hosted in OC4J 10.1.3. 该应用程序托管在OC4J 10.1.3中。 When the error occurs, it kills not only my app, but also the Java console. 发生错误时,它不仅杀死我的应用程序,而且杀死Java控制台。

I've added the below options to the server properties in the Application Sever Control, as suggested in some other questions, but to no avail. 正如其他一些问题所建议的那样,我已在“应用程序服务器控制”中的服务器属性中添加了以下选项,但无济于事。

-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled

The error as recorded in the java console is as such, taken from the trace file: 在Java控制台中记录的错误是从跟踪文件中提取的:

Couldn't process record:
java.lang.OutOfMemoryError: PermGen space
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(Unknown Source)
    at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(Unknown Source)
    at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(Unknown Source)
    at sun.reflect.ReflectionFactory.newConstructorForSerialization(Unknown Source)
    at java.io.ObjectStreamClass.getSerializableConstructor(Unknown Source)
    at java.io.ObjectStreamClass.access$1500(Unknown Source)
    at java.io.ObjectStreamClass$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.io.ObjectStreamClass.<init>(Unknown Source)
    at java.io.ObjectStreamClass.lookup(Unknown Source)

I'm not sure what other info might be helpful, and I'm at a loss as to how to continue. 我不确定还有哪些其他信息可能会有所帮助,并且我对如何继续感到迷惑。 Any guidance would be welcome. 任何指导都将受到欢迎。

If you have ClassLoader/PermGen leaks in a web application you can get rid of them using the ClassLoader Leak Prevention library . 如果Web应用程序中存在ClassLoader / PermGen泄漏,则可以使用ClassLoader防泄漏库消除它们。

In case you want to track down leaks yourself this blog series will be of help. 如果您想自己查找泄漏,则本博客系列会有所帮助。

try first to increase your perm size as the default value is usually too low (for 64bit jvms mainly). 首先尝试增加烫发的大小,因为默认值通常太低(主要是对于64位的jvm)。

the arguments needed are -XX:PermSize and -XX:MaxPermSize 所需的参数是-XX:PermSize-XX:MaxPermSize

a max value of 256M is usually enought. 通常最大值是256M。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM