java.lang.OutOfMemoryError: Java heap space

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
via oracle.com by Unknown author

An easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options -Xmx512M, this will immediately solve your OutOfMemoryError.

,
via Stack Overflow by Eugene Yokota

In Eclipse : go to Run --> Run Configurations --> then select the project under maven build --> then select the tab "JRE" --> then enter -Xmx1024m.

This should increase the memory heap for all the builds/projects. The above memory size is 1 GB.

Solutions on the web

via Stack Overflow by rilott
, 7 months ago
via Stack Overflow by Unknown author, 2 years ago
via GitHub by codeanticode
, 1 year ago
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at java.io.PrintStream.write(PrintStream.java:430)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168)
at java.io.PrintStream.write(PrintStream.java:477)
at java.io.PrintStream.print(PrintStream.java:619)
at com.aqua.anttask.jsystem.JUnitTestRunner.handleOutput(JUnitTestRunner.java:595)
at com.aqua.anttask.jsystem.JSystemTask.handleOutput(JSystemTask.java:1225)
at org.apache.tools.ant.UnknownElement.handleOutput(UnknownElement.java:208)
at org.apache.tools.ant.Project.demuxOutput(Project.java:1202)
at org.apache.tools.ant.taskdefs.Ant.handleOutput(Ant.java:228)
at org.apache.tools.ant.UnknownElement.handleOutput(UnknownElement.java:208)
at org.apache.tools.ant.Project.demuxOutput(Project.java:1202)
at org.apache.tools.ant.DemuxOutputStream.processBuffer(DemuxOutputStream.java:172)
at org.apache.tools.ant.DemuxOutputStream.write(DemuxOutputStream.java:147)
at org.apache.tools.ant.DemuxOutputStream.write(DemuxOutputStream.java:241)
at java.io.PrintStream.write(PrintStream.java:430)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168)
at java.io.PrintStream.newLine(PrintStream.java:496)
at java.io.PrintStream.println(PrintStream.java:757)
at jsystem.framework.report.SystemOutTestReporter.report(SystemOutTestReporter.java:23)
at jsystem.framework.report.SystemOutTestReporter.report(SystemOutTestReporter.java:38)
at jsystem.framework.report.RunnerListenersManager.report(RunnerListenersManager.java:1456)
at jsystem.framework.report.DefaultReporterImpl.report(DefaultReporterImpl.java:107)
at jsystem.framework.report.DefaultReporterImpl.report(DefaultReporterImpl.java:55)
at jsystem.framework.report.DefaultReporterImpl.report(DefaultReporterImpl.java:59)

Users with the same issue

2 times, 5 days ago
3 times, 1 month ago
Once, 2 months ago
Once, 2 months ago
2 times, 3 months ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.