A JVM is used in all Jenkins agents to host the Jenkins JNLP agent as well as
to run any Java applications such as
javac, Maven, or Gradle.
For memory efficiency, the Jenkins image dynamically uses a 32-bit
JVM if it runs in a container with a memory limit under 2 GiB by default. The
JVM choice applies by default both for the Jenkins JNLP agent as well as for any
other Java processes within the agent container.
By default, the Jenkins JNLP agent JVM uses 50% of the container memory limit for
its heap. This value can be modified by the
environment variable. It can also be capped at an upper limit or overridden
By default any other processes run in the Jenkins agent container, such as
shell scripts or
oc commands run from pipelines, cannot use more
than the remaining 50% memory limit without provoking an OOM kill.
By default, each further JVM process that runs in a Jenkins agent container uses
up to 25% of the container memory limit for it’s heap. It might be necessary to
tune this limit for many build workloads.