Remaining work from #143085. We set -Xmx4g in the templates, which clears the other default jvm args that Gradle normally sets. We should set a value here after making sure that the values that landed for our CI cause no issues. See the description of the linked PR for more info.