OutOfMemoryError: Java heap space in the gaming infrastructure

I am creating a java-enabled web game application. When I ran it, an error occurred 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 

Does anyone know or may have the same problem, please give me advice.

+1
source share
3 answers

A quick workaround would be to increase the amount of JVM memory (as this is done depending on the JVM used, the Oracle JVM will support the -Xmx...m option, where ... represents the maximum memory in megabytes).

The JVM may initially get too little memory; if it is not, then checking for memory usage should help, for example. using jmap (create heap heaps) and jhat (analyze heap heaps).

+3
source

There was someone on the google list a few months ago who indicated that with some designs the groovy -template engine needs a lot of memory. I assume you have the same problem.

+1
source

This happens to me sometimes. @Thomas answer is the best solution, but if you need a quick fix, just turn off and restart Play.

0
source

All Articles