Grails PermGem 错误 [英] Grails PermGem error

查看:11
本文介绍了Grails PermGem 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助解决这个问题.我需要有人向我解释为什么会发生这种情况以及如何预防或避免它.

I need help with this problem. I need someone to explain to me why is this happening and how to prevent or avoid it.

Exception in thread "Thread-747" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-748" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-759" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-760" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-764" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-765" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-766" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-767" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-773" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-774" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-780" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-781" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-788" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-789" java.lang.OutOfMemoryError: PermGen space
2011-06-20 14:42:10,668 [http-8080-6] ERROR [/CM].[grails]  - Servlet.service() for servlet grails threw exception
java.lang.OutOfMemoryError: PermGen space
2011-06-20 14:42:10,668 [http-8080-6] ERROR [/CM].[default]  - Servlet.service() for servlet default threw exception
java.lang.OutOfMemoryError: PermGen space
: java.lang.OutOfMemoryError: PermGen space
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
        at _GrailsPackage_groovy$_run_closure8.doCall(_GrailsPackage_groovy:275)
        at _GrailsPackage_groovy$_run_closure8.call(_GrailsPackage_groovy)
        at _GrailsRun_groovy$_run_closure8.doCall(_GrailsRun_groovy:245)
        at RunApp$_run_closure1.doCall(RunApp.groovy:35)
        at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
        at gant.Gant.withBuildListeners(Gant.groovy:427)
        at gant.Gant.this$2$withBuildListeners(Gant.groovy)
        at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
        at gant.Gant.dispatch(Gant.groovy:415)
        at gant.Gant.this$2$dispatch(Gant.groovy)
        at gant.Gant.invokeMethod(Gant.groovy)
        at gant.Gant.executeTargets(Gant.groovy:590)
        at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.OutOfMemoryError: PermGen space
--- Nested Exception ---
java.lang.OutOfMemoryError: PermGen space
Error automatically restarting container: java.lang.OutOfMemoryError: PermGen space
Error executing script RunApp: PermGen space
java.lang.OutOfMemoryError: PermGen space
Error executing script RunApp: PermGen space
Application context shutting down...
Application context shutdown.

推荐答案

PermGen 是用于加载类的 JVM 内存区域.

The PermGen is a region of your JVM's memory that is used to load classes.

当您的应用程序执行时,它会使用越来越多的内存,尤其是在调试环境中,或者如果您大量使用闭包.

As you application executes, it uses more and more of this memory, especially if you are in a debugging environment, of if you make extensive use of closures.

解决这个问题的方法是添加更多!

The way to fix this is to add more of it!

这是通过在启动应用程序时向 JVM 传递一两个参数来完成的.

This is done by passing one or two parameters to the JVM when launching your application.

参数为:

-XX:MaxPermSize=256m
-XX:PermSize=128m

(根据您的特定需求调整值)

(adjust the values to your specific needs)

PermSize 将是 PermGen 的初始大小,MaxPermSize 将是在像您的帖子中那样抛出异常之前它会增加的最大大小.

The PermSize will be the initial size of the PermGen, and the MaxPermSize will be the maximum size at which it will increase before throwing you an exception like in your post.

默认情况下,它被设置为 64M,如果你有一个真正的"应用程序,这并不多.

By default, it is set to 64M, which is not much if you have a 'real' application.

注意:您的总内存使用将是:Heap size + Perm Size

这篇关于Grails PermGem 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆