My Jenkins jobs are running out of memory, giving java.lang.OutOfMemoryError
messages in the build log. But I used the Ubuntu Package Manager, aptitude
Another method to set the heap size for particular jobs is to use environment variables for each job. This ensures that the memory is available when the job that requires a higher memory is not in use.
GRADLE_OPTS="-Dorg.gradle.jvmargs=-Xms1024M -Xmx8192M -XX:PermSize=512M -XX:MaxPermSize=2048 -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
JAVA_OPTS="-XX:MaxPermSize=2048M"