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.expandCapacity(AbstractStringBuilder.java:137)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:622)
at java.lang.StringBuilder.append(StringBuilder.java:202)
at java.text.MessageFormat.applyPattern(MessageFormat.java:453)
at java.text.MessageFormat.(MessageFormat.java:362)
at java.text.MessageFormat.format(MessageFormat.java:840)
at org.postgresql.util.GT.translate(GT.java:81)
at org.postgresql.util.GT.tr(GT.java:28)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1861)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:410)
at com.zaxxer.hikari.proxy.PreparedStatementProxy.execute(PreparedStatementProxy.java:44)
at com.zaxxer.hikari.proxy.PreparedStatementJavassistProxy.execute(PreparedStatementJavassistProxy.java)
at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:39)
at slick.jdbc.StatementInvoker.iteratorTo(StatementInvoker.scala:22)
at slick.jdbc.StreamingInvokerAction$class.emitStream(StreamingInvokerAction.scala:28)
at slick.driver.JdbcActionComponent$QueryActionExtensionMethodsImpl$$anon$1.emitStream(JdbcActionComponent.scala:218)
at slick.driver.JdbcActionComponent$QueryActionExtensionMethodsImpl$$anon$1.emitStream(JdbcActionComponent.scala:218)
at slick.backend.DatabaseComponent$DatabaseDef$$anon$3.run(DatabaseComponent.scala:285)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Users with the same issue

23 times, 2 hours ago
Samebug visitor profile picture
Unknown user
Once, 4 hours ago
Once, 2 weeks ago
Once, 3 weeks ago
2 times, 1 month ago
54 more bugmates

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