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(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at java.io.StringWriter.write(Unknown Source)
at com.google.gson.stream.JsonWriter.string(JsonWriter.java:561)
at com.google.gson.stream.JsonWriter.value(JsonWriter.java:419)
at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:690)
at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:704)
at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:642)
at com.google.gson.internal.Streams.write(Streams.java:68)
at com.google.gson.JsonElement.toString(JsonElement.java:324)
at java.lang.String.valueOf(Unknown Source)
at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:89)
at org.openqa.selenium.remote.JsonToBeanConverter.convertMap(JsonToBeanConverter.java:344)
at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:215)
at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:43)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:74)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)

Users with the same issue

22 times, 3 days ago
Samebug visitor profile picture
Unknown user
Once, 2 years ago
2 times, 5 months ago
Samebug visitor profile picture
Unknown user
Once, 10 months ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
60 more bugmates

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