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

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at java.lang.StringBuilder.append(StringBuilder.java:76)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:484)
at java.lang.StringBuilder.append(StringBuilder.java:166)
at java.lang.StringBuilder.append(StringBuilder.java:76)
at java.util.Formatter$FixedString.print(Formatter.java:2595)
at java.util.Formatter.format(Formatter.java:2508)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at org.assertj.core.util.Strings.formatIfArgs(Strings.java:91)
at org.assertj.core.error.MessageFormatter.format(MessageFormatter.java:61)
at org.assertj.core.error.BasicErrorMessageFactory.create(BasicErrorMessageFactory.java:110)
at org.assertj.core.internal.Failures.failure(Failures.java:112)
at org.assertj.core.internal.CommonValidations.checkSizes(CommonValidations.java:117)
at org.assertj.core.internal.Iterables.assertHasSize(Iterables.java:173)
at org.assertj.core.api.AbstractIterableAssert.hasSize(AbstractIterableAssert.java:136)

Users with the same issue

Once, 2 months ago
2 times, 6 months ago
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
22 times, 6 days ago
56 more bugmates

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