Skip to content

Commit

Permalink
Assign memory to fork options for recompile and execute. Should fix s…
Browse files Browse the repository at this point in the history
…everal OOM related issues with the recompile and decompile cycle.
  • Loading branch information
marchermans committed Nov 5, 2023
1 parent 7bb419d commit a25238a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ interface Execute extends WithWorkspace, WithOutput, WithJavaVersion, ExecuteSpe
java.setWorkingDir(me.getOutputDirectory().get())
java.getMainClass().set(mainClass)
java.setStandardOutput(log_out)

java.setMaxHeapSize(String.format("%dk", Runtime.getRuntime().maxMemory() / 1000))
}).rethrowFailure().assertNormalExitValue()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public RecompileSourceJar() {
getOptions().setFork(true);
getOptions().setIncremental(true);
getOptions().getIncrementalAfterFailure().set(true);
getOptions().getForkOptions().setMemoryMaximumSize(String.format("%dk", java.lang.Runtime.getRuntime().maxMemory() / 1000));

//Leave this as an anon class, so that gradle is aware of this. Lambdas can not be used during task tree analysis.
//noinspection Convert2Lambda
Expand Down

0 comments on commit a25238a

Please sign in to comment.