The size of the JVM can be controlled through the file $CONNECT/components/agent/swarm/env.sh.
Edit this file in a text editor to preserve its line endings. This file must have Unix-style line-endings (LF). If saved with Windows-style line-endings (CR LF), the container will not function as expected.