This is a simple Java application to show the runtime's current memory allocation to test JVM flags.
To run this application simply download the .jar
-file from the releases tab. I recommend downloading latest java-memory-x.x.x-jar-with-dependencies.jar
as it contains all necessary dependencies.
To build this project on your own just run
mvn clean compile assembly:single
in the project's root. Then cd
to the target
-folder and there you go!
Try running the .jar
from shell:
java -jar java-memory-x.x.x-jar-with-dependencies.jar
Look at the runtime's max memory. Now try using 4 GB
of RAM:
java -Xmx4G -jar java-memory-x.x.x-jar-with-dependencies.jar
See the difference? 😄