-XX:MaxRAMPercentage isn’t working?
Have you removed your -Xmx setting yet? Often (e.g. OpenJDK, IBM, Red Hat), if you specify both and -XX:MaxRAMPercentage, -Xmx will take precedence and -XX:MaxRAMPercentage will simply be ignored — although exceptions are starting to be introduced. If you are deploying your Java application to containers and your memory limits are less than the Xmx, you may find that your container continually restarts with an OOMKilled message. Even if not deploying to containers or you happen to be using a Java distribution that doesn’t prioritize -Xmx, specifying both Xmx and MaxRAMPercentage is confusing and misleading.
If you are using -XX:MaxRAMPercentage, please remove your -Xmx setting.