发生了OutOfMemoryError:Play框架中的Java堆空间 [英] OutOfMemoryError occured : Java heap space in play framework

查看:277
本文介绍了发生了OutOfMemoryError:Play框架中的Java堆空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用java创建基于游戏的Web应用程序。当我运行它时出现错误,出现以下错误:

I am creating play-based web application with java. When I run it an error occured with the following error:

Execution exception (In /app/controllers/Application.java around line 12)
OutOfMemoryError occured : Java heap space

play.exceptions.JavaExecutionException: Java heap space
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:227)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:3209)
at java.lang.String.<init>(String.java:215)
at java.lang.StringBuffer.toString(StringBuffer.java:585)
at java.io.StringWriter.toString(StringWriter.java:193)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:248)
at play.templates.Template.render(Template.java:26)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:657)
at play.mvc.Controller.renderTemplate(Controller.java:637)
at play.mvc.Controller.render(Controller.java:692)
at controllers.Application.index(Application.java:12)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:540)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:498)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:474)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:469)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:157)
... 1 more

任何人都知道或者有同样的问题,请给我建议。

Anybody know or maybe has the same problem, please give me advise.

推荐答案

快速解决方法是增加JVM的内存(如何完成取决于使用的JVM,Oracle的JVM)将支持 -Xmx ... m 选项,其中...表示以兆字节为单位的最大内存。

A quick workaround would be to increase the memory of the JVM (how that's done depends on the JVM in use, Oracle's JVM would support the -Xmx...m option, where ... represents the maximum memory in megabytes).

JVM最初可能会获得太少的内存,如果不是这样,那么检查内存使用情况应该会有所帮助,例如使用jmap(创建堆转储)和jhat(分析堆转储)。

The JVM might initially get too little memory, if that's not the case then checking the memory usage should help, e.g. using jmap (create heap dumps) and jhat (analyze heap dumps).

这篇关于发生了OutOfMemoryError:Play框架中的Java堆空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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