Java: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

If you've ever encountered this error, it means your project (or the application you're trying to run) has used too much memory.

To remedy this, find the script that is executing it and add in a new argument "-Xmx1024m".

This will set the maximum heap size to 1024mb. You can use any other value, but I was parsing a big Android method trace file using traceview.

For example, "traceview.bat" contains this line at the end:

call %java_exe% -Djava.ext.dirs=%javaextdirs% -jar %jarpath% %*

Simply add in the argument:

call %java_exe% -Xmx1024m -Djava.ext.dirs=%javaextdirs% -jar %jarpath% %*

And it'll work properly.

Java, "it just works".

Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog