diff --git a/DEVELOPING.md b/DEVELOPING.md index 50ff9c9ba..f45c381b6 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -94,4 +94,8 @@ Add localized strings in `src/main/resources/messages/LibertyBundles_{locale}.pr All translatable text should be included in the message file(s). Message parameters should only contain language neutral text. ### Test Videos -To record videos for all tests, not just the failed ones, you can create a `video.properties` file in the `src/test/resources` directory and add `video.save.mode=ALL` to that file. \ No newline at end of file +To record videos for all tests, not just the failed ones, you can create a `video.properties` file in the `src/test/resources` directory and add `video.save.mode=ALL` to that file. +### Handling Out of Memory Errors in Build or Tests +If you encounter an "OutOfMemoryError" during compilation or running tests, it may be due to insufficient heap space for the Java process. To resolve this: +1. Open the `build.gradle` file. +2. Increase the `memoryMaximumSize` in the `JavaCompile` task. For example: `tasks.withType(JavaCompile) { options.forkOptions.memoryMaximumSize = "4g" // Increase to 4GB or more if needed }` \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8fef514fb..c84d17762 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,10 @@ allprojects { tasks.withType(JavaCompile) { options.encoding = 'UTF-8' options.fork = true + // Increase Java heap size to avoid OutOfMemoryError during compilation or tests. + // This setting addresses issues where the JVM runs out of memory, particularly during + // large builds or tests. The '2g' value specifies a maximum heap size of 2GB + // (-Xmx2g), which should be enough to prevent memory exhaustion in most cases. options.forkOptions.memoryMaximumSize = "2g" } }