Skip to content

Commit

Permalink
Merge pull request #1200 from staicy123/#1157-Describe-java-heap-size
Browse files Browse the repository at this point in the history
Added comment in build.gradle and developing.md for heap size
  • Loading branch information
staicy123 authored Jan 4, 2025
2 parents 7708ac2 + 55379f8 commit af7f711
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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 }`
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down

0 comments on commit af7f711

Please sign in to comment.