【问题标题】:Why am I receiving java.lang.OutOfMemoryError: PermGen space error?>为什么我收到 java.lang.OutOfMemoryError: PermGen space error?>
【发布时间】:2013-02-19 05:16:30
【问题描述】:

我正在使用 java 开发一个应用程序,并且我使用 GlassFish Serve 3+ 作为我的容器,有时当我运行我的应用程序时遇到以下错误,我想知道是什么原因,

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: PWC1243: Filter execution threw an exception
root cause

java.lang.OutOfMemoryError: PermGen space
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.2.2 logs.

【问题讨论】:

  • 看看这个link。有人问过类似的问题。
  • 它对内存泄漏没有帮助 - 但有趣的是 Java 8 已经取消了 Perm Gen。

标签: java glassfish-3


【解决方案1】:

java.lang.OutOfMemoryError

当 Java 虚拟机无法分配对象时抛出,因为 内存不足,无法再提供内存 垃圾收集器。 OutOfMemoryError 对象可以由 虚拟机好像禁用了抑制和/或堆栈跟踪 不可写。

检查您是否使用new 关键字创建了太多对象。要查找的位置是循环、递归方法等。

【讨论】:

    【解决方案2】:

    在 JAVA_OPTS 环境变量中设置 PermSize [用于为 Java JVM 分配内存] 如果已设置,则增加 MaxPermSize

    例如:

    JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx1024m -XX:MaxPermSize=1024m -XX:PermSize=128m"

    更多关于 JAVA_OPTS 的详细信息在这里

    http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.3/reference/JavaOptsSummary.html

    【讨论】:

    • 初始 PermSize 无济于事。如果您有泄漏,Max 会延迟问题。
    【解决方案3】:

    我知道在 NetBeans 的默认 glassfish 配置中,它不会告诉服务器清理其未使用的类。尝试以下解决方案:

    Glassfish PermGen out of Memory Errors

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-25
      • 2012-01-19
      • 1970-01-01
      • 1970-01-01
      • 2010-09-10
      • 2013-04-04
      • 1970-01-01
      相关资源
      最近更新 更多