I developed a simple Spring Boot application (microservice you might say) and deployed with a simple java -jar ... -Xmx 128M. Yet, I can see using the ps command that the allocated memory for the process is actually 6237.26 Mb.
Now, I've read that and understood about the fact that -Xmx actually limits the process heap size but my question is:
- Why does the JVM allocates so much RAM?
- How can I limit it to a reasonable size?
Update:
Following the suggestion in the comment, I moved the -Xmx128M and now it's has allocated 4300MB of RAM. Still a monster.