Resolving OutOfMemoryError: Java Heap Space or GC Overhead
Description:
When running a Parasoft Test based product, you may see the error:
"java.lang.OutOfMemoryError: Java heap space".
or
"An internal error occurred during: "Building workspace".
GC overhead limit exceeded"
Cause:
This error occurs when Java runs out of memory.
Resolution:
To resolve this issue, you have two options:
- Reduce the amount of memory that the software is using. This is the recommended approach, since it usually involves applying Best Practices.
- Increase the amount of memory available to the software, as described below.
Allocating More Memory to the JVM
In some cases, the default amount of memory allocated to the JVM in which SOAtest / LoadTest / Virtualize runs may need to be increased when dealing with large test suites or complex scenarios.
Parasoft Test products
32-bit versions use 896MB by default.
64-bit versions use 1792MB by default - 896MB if using SOAtest <9.4
To increase the maximum heap size, pass a -J-Xmx argument to the executable.
For example, "cpptest -J-Xmx1400m" would start C/C++test with the maximum heap size set to 1400MB.
Tips
- Other JVM arguments can be configured in similar way. Each JVM argument must be prefixed with "-J" when passed to the executable.
- Multiple JVM arguments can be passed together with each argument prefixed with with "-J". For example, "soatest -J-Xmx1400m -J-Xms1024m" sets the max heap size to 1400MB and the starting heap size to 1024MB.
Detail about JVM arguments can be found here:
- http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html#nonstandard
- http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
- https://docs.oseems.com/general/application/eclipse/fix-gc-overhead-limit-exceeded
- http://stackoverflow.com/questions/28060920/how-to-fix-java-lang-outofmemoryerror-gc-overhead-limit-exceeded-error